Skip to main content

Module chatbot_conversation_messages

Module chatbot_conversation_messages 

Source

Structs§

ChatbotConversationMessage
ChatbotConversationMessageRow
ClientToolAnswerOutcome
What answering a client tool call left the suspended turn in.

Enums§

Message
ReasoningPayload
Whether a reasoning message is read with its encrypted_content.
UnansweredToolCallScope
Which unanswered tool calls a repair may abort.

Functions§

abort_pending_client_tool_calls
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.
answer_client_tool_call
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.
answer_hanging_tool_call_messages_for_conversation
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.
answer_unanswered_tool_calls 🔒
Answers with output_text every unanswered tool call of the conversation that needs_answering accepts, and returns the ones it left alone.
delete
delete_message_fields
get_by_conversation_id
get_by_conversation_id_for_display
get_by_conversation_id for callers that only display the conversation.
get_conversation_messages 🔒
get_inner_messages 🔒
The inner message of each of message_ids, keyed by the id of the message carrying it.
get_latest_developer_message_text
The text of the conversation’s newest developer message, which is where its page context is recorded.
get_message_fields
The inner message of the given ChatbotConversationMessage.
get_reasonings 🔒
get_text_messages 🔒
get_tool_calls 🔒
get_tool_outputs 🔒
insert
Appends a message to a conversation, allocating the next order_number for it.
insert_for_conversation_user_and_configuration
insert_locked 🔒
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.
lock_conversation_for_order_number_allocation 🔒
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.
missing_inner_message_error 🔒
tool_call_output_message 🔒
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.
turn_is_suspended
Whether the conversation’s newest turn is suspended: waiting for the client to answer a ClientTool call it made.
update
waiting_client_tool_call_ids
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.