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_gateway_stub(user_input, testing=False)[source]#

Returns the stub for gateway in the flow.

Return type

Dict

get_executor_stubs(user_input, testing=False, **kwargs)[source]#

Returns the stubs for the executors in the flow.

Return type

Dict

setup(user_input, testing=False, **kwargs)[source]#

Runs before the flow is deployed to setup the flow in self.flow_yaml. Common use cases:

  • create a database

  • finetune a model + push the artifact

  • notify other services

  • check if starting the app is currently possible

Parameters
  • user_input (UserInput) – user configuration based on the given options

  • testing – use local executors if True

Return type

Dict

preprocess(docs)[source]#

Loads and preprocesses every document such that it is ready for indexing.

Return type

DocumentArray

is_demo_available(user_input)[source]#
Return type

bool

property max_request_size: int#

Max number of documents in one request

Return type

int

static add_telemetry_env(flow_yaml_content)[source]#