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Β§
- Tool
Round π - 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Β§
- Pending
Round πItem - One item of a tool-call round, held until the round is known complete so it can be stored in its original stream order.
- Planned
Tool πCall - What the round does with one call the model made.
- Storage
Plan π - How a round item that isnβt a text
MessageorFunctionCallgets 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
itemstores 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
MessageorFunctionCall:ReasoningandAzureAiSearchCallinsert as-is, a refusalMessageinserts as-is, and anAzureAiSearchCallOutputadditionally resolves its cited documents (seestore_search_output_with_citationsfor why that half alone swallows its errors). Errors on a textMessage,FunctionCallorFunctionCallOutputβ seestorage_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.