Asynchronous Tasks

Celery tasks for the plugin app.

smarter.apps.llmtool.tasks.describe_tool_call_label(label_json)[source]

Describe the label that the app sent with a tool call, for the tool worker’s log.

Parameters:

label_json (str | None) – The ToolCallLabel, as JSON, or None.

Return type:

str

Returns:

The label’s description, or unlabeled.

smarter.apps.llmtool.tasks.describe_tool_call_outcome(result)[source]

Describe a tool call’s outcome for the tool worker’s log, without its value or its failure’s text.

A failure’s text can hold what the tool or its server answered, e.g. a database driver’s message with a user name, so only the kind of outcome and the HTTP status are logged.

Parameters:

result (ToolCallResult) – The call’s result.

Return type:

str

Returns:

succeeded, tool error or failed, with `` (HTTP <status>)`` when there was a response.

smarter.apps.llmtool.tasks.log_tool_call(kind, label_json, result, started)[source]

Log one line for a tool call that the tool worker ran: what it was for, and how it ended.

It logs at INFO, through tool_worker_logger, which no waffle switch silences: the tool worker has no database to read a switch from. A call that couldn’t be made, or that the tool answered with an error, is a WARNING.

Parameters:
Return type:

None

smarter.apps.llmtool.tasks.tool_worker_logger = <WaffleSwitchedLoggerWrapper logger=smarter.apps.llmtool.tasks>

the tool worker has no database to read one from.

Type:

The tool worker’s logger, which no switch silences