Skip to main content

final class atoti_ai.AiConfig

Atoti Intelligence configuration. See the Atoti Intelligence documentation for more details.
This feature is experimental, its key is "ai".

Example

Atoti Intelligence can also be enabled without an LLM provider: install no provider package (i.e. atoti[ai]) and leave connection and chat set to None. AutoExplain then returns a default, non-AI summary and the chat feature is disabled:
Opting out of dynamic_tool_discovery:
Serving no chat at all:
Keeping more Auto-Explain analyses retrievable from the chat, for longer:

auto_explain_retained_run_count : int | None = None

How many Auto-Explain analyses the session keeps retrievable from the chat. A user can ask the chat for an analysis that already ran instead of running it again. This is the total the session keeps, across all its users. Once it is reached, running another analysis drops the one that ran first. When left unset, the session keeps 100 analyses.

auto_explain_run_lifetime : timedelta | None = None

How long an Auto-Explain analysis stays retrievable from the chat. Counted from the moment the analysis ran. Past it, the analysis has to run again. When left unset, an analysis stays retrievable for 100 minutes.

chat : ChatConfig | None = None

The configuration of the chat model.

chat_enabled : bool | None = None

Whether this session serves chat. Set to False to register no chat endpoint: every call to one answers 404, and atoti.Session.chat reports chat as absent. atoti.Cube.auto_explain and the MCP server keep working. This differs from leaving connection and chat unset: a session with no LLM keeps the chat endpoints registered, and starts answering as soon as an LLM is configured. When left unset, the server serves chat.

connection : ConnectionConfig | None = None

The configuration of the connection to the LLM provider.

dynamic_tool_discovery : bool | None = None

Whether the chat sends the LLM only the tools matching each request. The LLM calls a tool search tool that queries a keyword index. It receives only the matching tools, which reduces prompt token usage and improves tool selection. Set to False to send the whole tool set on every request instead. A small tool set, where searching brings no benefit, is one reason to do so. Inspecting which tools the LLM can see is another. Defaults to True when left unset.

max_attempts : int = 5

How many times a call to the LLM is sent, retries included. A failed request is re-sent by the provider’s own client, backing off between attempts. This bounds that for whichever provider the session connects to, taking precedence over the provider’s own property. Set it to 1 to disable retries. Each attempt is bounded by the connection timeouts, and under Amazon Bedrock the whole call is bounded by atoti_ai_amazon_bedrock.ConnectionConfig.timeout.

max_consecutive_identical_tool_calls : int = 3

How many rounds in a row one prompt may call a tool with the very same arguments. Past that the call is not run again: the model is told it was just made and returned the same thing, and does something else instead. Round after round, an identical call makes no progress, and a prompt telling the model to retry until it works would otherwise repeat it until prompt_timeout expires. Any round without that call starts a fresh run, so a tool the model comes back to after doing something else keeps running, however many times. Each call is counted on its own, so a round asking for several tools at once loses only the one the model is stuck on and still runs the others. That round is charged one max_tool_errors failure all the same, so a model pairing the call it is stuck on with a fresh one is stopped too.

max_consecutive_refused_rounds : int = 3

How many rounds in a row may run no tool at all before the run ends. Refusing a call answers the model, which may simply ask for it again, and each of those rounds is one more call to the LLM. Once that many have run no tool at all, the run ends and the user is told the question could not be answered. Any round that runs a tool starts the count over.

max_retry_attempts : int = 1

How many times the chat sends a prompt to the LLM, retries included. Left at 1, the prompt is sent once and the retrying is left to the LLM provider: its client backs off between attempts and does not retry a request it knows is hopeless, neither of which this loop can do. See max_attempts. Raise it only for failures happening outside the provider call, such as a malformed tool call from the model. Each attempt re-runs the whole prompt, tools included.

max_tool_errors : int = 5

How many tool calls one prompt may see fail before it stops calling tools. Once that many have failed, the model is told to stop and answer with what it has, instead of trying another tool call. This bounds a model working through a broken request, which repeating-call detection misses when it varies its arguments. The budget covers the whole prompt, the max_retry_attempts retries included. A round in which a call was refused counts as one failure too, once for the round however many of its calls were refused. A run in which three rounds in a row ran no tool at all ends outright.

mcp : McpClientConfig | None = None

The configuration of the MCP servers to take additional tools from.

prompt_timeout : timedelta = datetime.timedelta(seconds=300)

How long the chat spends on one prompt before giving up. This deadline covers everything a prompt does: every tool call and every retry the LLM provider makes underneath it. Set it to timedelta() to leave the prompt no deadline.