Skip to main content

abort_pending_client_tool_calls

Function abort_pending_client_tool_calls 

Source
pub async fn abort_pending_client_tool_calls(
    conn: &mut PgConnection,
    conversation_id: Uuid,
    output_text: &str,
) -> ModelResult<()>
Expand description

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.

Must be called inside the transaction that inserts the new user message: it takes the conversation lock and the caller’s transaction holds it to the end, which is what makes the abort and the new message one decision against a concurrent answer_client_tool_call. Called on its own the lock is released immediately and a resume can slip in between.