Skip to main content

Module round

Module round 

Source
Expand description

One tool-call round: running the calls the server answers, storing each beside its output, and handing the round’s items on to the next request.

StructsΒ§

ToolRound πŸ”’
What one tool-call round accumulates while it streams: the items it acts on once Azure has sent them all, the input the next round is sent, and whether the turn ends suspended instead of asking again.

EnumsΒ§

PendingRoundItem πŸ”’
One item of a tool-call round, held until the round is known complete so it can be stored in its original stream order.
PlannedToolCall πŸ”’
What the round does with one call the model made.
StoragePlan πŸ”’
How a round item that isn’t a text Message or FunctionCall gets persisted, decided without a database connection or Azure configuration: a plain insert, or an insert followed by resolving the search result’s cited documents.

ConstantsΒ§

UNSTORABLE_OUTPUT_PLACEHOLDER πŸ”’
What is stored for a call whose real output could not be written. Short by construction: an output too large for its column is the way that write fails.

FunctionsΒ§

is_stored_by_round πŸ”’
Whether the round that produced item stores it itself, so that whoever else sees the item must not store it as well.
item_without_reasoning_payload πŸ”’
The item with a reasoning payload left out, for an event that only names the item.
parse_tool πŸ”’
Streams and parses one tool-call round of a response from Azure, consuming lines.
plan_tool_call πŸ”’
Decides who answers a call the model made, before anything about it is stored.
record_tool_call πŸ”’
Stores a finished tool call beside its output, and converts both rows back into the items the next round is sent.
record_tool_call_with_fallback πŸ”’
record_tool_call, falling back to a placeholder output when the real one cannot be written.
recover_or_terminate πŸ”’
Decides whether a tool-call error ends the turn or is reported to the LLM as a failed call.
storage_plan πŸ”’
Routes an output item to how it should be persisted, or rejects it.
store_output_item πŸ”’
Persists a round item that isn’t a text Message or FunctionCall: Reasoning and AzureAiSearchCall insert as-is, a refusal Message inserts as-is, and an AzureAiSearchCallOutput additionally resolves its cited documents (see store_search_output_with_citations for why that half alone swallows its errors). Errors on a text Message, FunctionCall or FunctionCallOutput β€” see storage_plan.
store_search_output_with_citations πŸ”’
Inserts an Azure AI Search output item, then best-effort resolves its cited documents.
tool_failure_output_for_llm πŸ”’
Turn a failed tool call into a function call output the LLM can act on, so it can recover or explain the failure to the user instead of the turn dying.