Ends the wait of every still unanswered
ClientTool call of the
conversation by answering it with output_text, so a suspended turn cannot outlive the message
that replaced it.
Records the client’s answer to a tool call of a suspended turn and reports whether the turn
may now resume. output is the answer in the form the LLM reads; client_answer is the
payload the client sent, kept for callers that need the answer as data, and None when no client
answer was applied.
Sometimes during chatbot conversation streaming, the stream ends unexpectedly while a
tool call has been made but not answered. This happens also with provider tools that
we can’t control. In this case, the conversation is left in a state which is invalid,
so we need to answer the un-answered tool calls to inform of the failure and continue
the conversation.
insert for a caller whose own transaction already holds the conversation lock, which is what
makes the order_number allocation safe. Taking it again would only cost round trips.
Locks the conversation row so that only one transaction at a time allocates an
order_number for it; without this two concurrent inserts pick the same number and one
of them violates the (conversation_id, order_number, deleted_at) unique index.
The output message that answers tool_call, inheriting the kind and the response id of the
call. An output we author has no Azure response of its own, and inventing an id would collide
with the citation re-pointing that matches on response_id.
The tool_call_ids of the conversation’s client tool calls that no output answers, in message
order: what a suspended turn is waiting for the client to answer.