cellmap_flow.ai_annotate.backends

The providers a config may name, behind one interface (base.Backend).

get_backend builds the provider a config entry describes. Adding a provider type is a module here, a branch in get_backend, and its options in config.PROVIDER_OPTIONS.

Submodules

Attributes

DEFAULT_TIMEOUT_S

DEFAULT_VERTEX_LOCATION

Exceptions

AIAnnotateError

A failure the user can be told about, as a category and a safe message.

Functions

get_backend(provider)

The backend for a config.ProviderConfig; a config error for an unknown type.

Package Contents

cellmap_flow.ai_annotate.backends.DEFAULT_TIMEOUT_S = 120
cellmap_flow.ai_annotate.backends.DEFAULT_VERTEX_LOCATION = 'global'
exception cellmap_flow.ai_annotate.backends.AIAnnotateError(category, user_message, *, http_status=None)

A failure the user can be told about, as a category and a safe message.

str() of it is the user message too, so a caller that logs or returns str(e) by habit still shows nothing unvetted. http_status overrides the category’s default, e.g. 400 for a request naming a model the config does not allow.

CATEGORIES = ('config', 'auth', 'quota', 'timeout', 'bad_response', 'unavailable', 'refused', 'limit')
category
user_message
http_status
cellmap_flow.ai_annotate.backends.get_backend(provider)

The backend for a config.ProviderConfig; a config error for an unknown type.