now.app.base.app module#
- class now.app.base.app.JinaNOWApp[source]#
Bases:
object
Interface for Jina NOW applications. To create a new application, you need to inherit from this class and override the methods. Example:
- class TextToImageApp(JinaNowApp):
pass
- property app_name: str#
Name of the app. Should be an enum value set in now.constants.Apps
- Return type
str
- property is_enabled: bool#
Set to True if this app is enabled for the end user.
- Return type
bool
- property description: str#
Short description of the app.
- Return type
str
- property bff: Optional[str]#
TODO This function is currently not used but already introduces the concept of custom bff Used to configure the bff which is used to define input and output format. :rtype:
Optional
[str
] :return: the path to the file where the bff routs are configured
- property playground: Optional[str]#
TODO This function is currently not used but already introduces the concept of custom playground Used to configure the playground(streamlit app) where the user can run example queries :rtype:
Optional
[str
] :return: the path to the streamlit file.
- property options: List[DialogOptions]#
Get the options which are used to configure the app. Base class should override this function and return the list of their option. Check
DialogOptions
for the format of the options On CLI the user will get a prompt and at the storefront, a GUI will be generated accordingly. Example:return [options.your_custom_options`]
:rtype:List
[DialogOptions
] :return: List[DialogOptions]
- property demo_datasets: Dict[TypeVar, List[DemoDataset]]#
Get a list of example datasets for the app.
- Return type
Dict
[TypeVar
,List
[DemoDataset
]]
- property finetune_datasets: [Tuple]#
Defines the list of demo datasets which are fine-tunable.
- Return type
[Tuple]
- set_app_parser(parser, formatter)[source]#
This parser reads from the options property and parses it to form the command line arguments for app
- Return type
None
- get_executor_stubs(dataset, user_input, **kwargs)[source]#
Returns the stubs for the executors in the flow.
- Return type
Dict
- setup(dataset, user_input, **kwargs)[source]#
Runs before the flow is deployed. Common use cases:
create a database
finetune a model + push the artifact
notify other services
check if starting the app is currently possible
- Parameters
dataset (
DocumentArray
) –user_input (
UserInput
) – user configuration based on the given options
- Return type
Dict
- Returns
dict used to replace variables in flow yaml and to clean up resources after the flow is terminated
- preprocess(docs)[source]#
Loads and preprocesses every document such that it is ready for indexing.
- Return type
DocumentArray
- property max_request_size: int#
Max number of documents in one request
- Return type
int