parse_anthropic_request

Function parse_anthropic_request 

Source
pub fn parse_anthropic_request(body: &Value) -> Result<ChatRequest, String>
Expand description

Parse an Anthropic Messages API request into the canonical ChatRequest. The Anthropic native format has:

  • model: string (required)
  • messages: array of {role, content} (required)
  • system: string or array of {type: “text”, text} (optional, top-level)
  • max_tokens: int (required)
  • temperature, top_p: float (optional)
  • stop_sequences: array of strings (optional)
  • stream: bool (optional)
  • tools: array of {name, description, input_schema} (optional)
  • tool_choice: {type: “auto”|“any”|“tool”, name: string} (optional)