Skip to main content

pair

Function pair 

Source
pub fn pair(history: Vec<Option<Message>>, pairing: Pairing) -> Paired
Expand description

The one rule for when a tool call is answered. None is a turn the caller emptied; it ends waiting calls like a turn.

  • A result answers the first call of the turn before it still waiting with its id; a result nothing waits for is dropped.
  • A turn that ended in an error or was aborted is kept; its calls wait for nothing.
  • A call still waiting at a user message with more than results, the next turn or the end gets a close_pending result, before the user message’s own content.
  • Adjacent non-empty user messages become one, and a system message arriving while calls wait is held until they are answered.