Skip to main content

parse_model_response

Function parse_model_response 

Source
pub fn parse_model_response(body: &str) -> Result<ModelTurn, AgentError>
Expand description

Read the text and tool calls out of a raw response body from OpenAI Chat Completions (choices[0].message), the OpenAI Responses API (output), Anthropic Messages (content blocks), or Ollama’s /api/chat (message).

§Errors

AgentError::ParseError if the body is not JSON or matches none of them.