now.now_dataclasses module#

This module implements a command-line dialog with the user. Its goal is to configure a UserInput object with users specifications. Optionally, values can be passed from the command-line when jina-now is launched. In that case, the dialog won’t ask for the value.

class now.now_dataclasses.TrainDataGeneratorConfig(method, parameters, scope)[source]#

Bases: object

Configuration of a specific data generation method for an encoder model.

method : Method to generate “artificial queries”. parameters : Parameters to pass to the training data generation method. scope : Fields to apply the method on.

method: str#
parameters: Dict[str, Any]#
scope: List[str]#
class now.now_dataclasses.TrainDataGenerationConfig(query, target)[source]#

Bases: object

Configuration of the training data generation for a bi-encoder which encodes queries and targets.

query : Method to generate “artificial queries”. target : Method to generate training targets and do preprocessing before

encoding documents.

query: now.now_dataclasses.TrainDataGeneratorConfig#
target: now.now_dataclasses.TrainDataGeneratorConfig#
class now.now_dataclasses.EncoderConfig(name, encoder_type, train_dataset_name, training_data_generation_methods)[source]#

Bases: object

Configuration of an encoder to encode queries and targets (text+image).

name : Encoder name. encoder_type : Datatypes which are matched by this encoder pair - in the first

version either “text-to-text” or “text-to-image”.

train_dataset_name: Name of a dataset generated for this encoder. training_data_generation_methods: Configuration of methods to generate training data.

name: str#
encoder_type: str#
train_dataset_name: str#
training_data_generation_methods: List[now.now_dataclasses.TrainDataGenerationConfig]#
class now.now_dataclasses.Task(name, encoders, indexer_scope)[source]#

Bases: object

Task configuration for text to text+image apps.

name : Unique name for the task. encoders : Configuration of the models to encode queries and

elastic search documents.

indexer_scope: Fields to consider during indexing for each modality.

name: str#
encoders: List[now.now_dataclasses.EncoderConfig]#
indexer_scope: Dict[str, str]#
class now.now_dataclasses.UserInput(**data)[source]#

Bases: pydantic.main.BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

app_instance: Optional[JinaNOWApp]#
data: Optional[str]#
custom_dataset_type: Optional[now.constants.DatasetTypes]#
dataset_name: Optional[str]#
dataset_url: Optional[str]#
dataset_path: Optional[str]#
aws_access_key_id: Optional[str]#
aws_secret_access_key: Optional[str]#
aws_region_name: Optional[str]#
task_config: Optional[now.now_dataclasses.Task]#
es_text_fields: Optional[List]#
es_image_fields: Optional[List]#
es_index_name: Optional[str]#
es_host_name: Optional[str]#
es_additional_args: Optional[Dict]#
cluster: Optional[str]#
deployment_type: Optional[str]#
secured: Optional[pydantic.types.StrictBool]#
jwt: Optional[Dict[str, str]]#
admin_emails: Optional[List[str]]#
user_emails: Optional[List[str]]#
additional_user: Optional[pydantic.types.StrictBool]#
class Config[source]#

Bases: object

arbitrary_types_allowed = True#
class now.now_dataclasses.DialogOptions(name, prompt_message, prompt_type, choices=None, is_terminal_command=False, description=None, depends_on=None, conditional_check=None, post_func=None)[source]#

Bases: object

name: str#
prompt_message: str#
prompt_type: str#
choices: Union[List[Dict[str, Union[str, bool]]], Callable[[Any], List[Dict[str, str]]]] = None#
is_terminal_command: pydantic.types.StrictBool = False#
description: str = None#
depends_on: Optional[DialogOptions] = None#
conditional_check: Callable[[Any], bool] = None#
post_func: Callable[[Any], None] = None#