cellmap_flow.ai_annotate.errors

The one error type AI-assisted annotation raises, and what the user is shown.

A hosted model’s SDK raises exceptions whose text can hold request details, response bodies or, for a key-based provider, the key itself. The dashboard shows errors in the browser, so it must never show str(e) from an SDK. Everything in this package raises AIAnnotateError instead: a category the routes turn into an HTTP status, and a short user_message written here, safe to show. The SDK’s own detail goes to the server log only, where the redacting filter (secrets) has already removed registered secrets.

Attributes

CATEGORIES

INSTALL_HINT

Exceptions

AIAnnotateError

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

Module Contents

cellmap_flow.ai_annotate.errors.CATEGORIES = ('config', 'auth', 'quota', 'timeout', 'bad_response', 'unavailable', 'refused', 'limit')
cellmap_flow.ai_annotate.errors.INSTALL_HINT = "The google-genai package is not installed in the dashboard's environment: run `pixi install -e...
exception cellmap_flow.ai_annotate.errors.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