diff --git a/server.py b/server.py index c313ccd..b91a233 100644 --- a/server.py +++ b/server.py @@ -172,7 +172,7 @@ class Tool(BaseModel): input_schema: Dict[str, Any] class ThinkingConfig(BaseModel): - enabled: bool + enabled: bool = True class MessagesRequest(BaseModel): model: str @@ -547,13 +547,17 @@ def convert_anthropic_to_litellm(anthropic_request: MessagesRequest) -> Dict[str # Create LiteLLM request dict litellm_request = { - "model": anthropic_request.model, # t understands "anthropic/claude-x" format + "model": anthropic_request.model, # it understands "anthropic/claude-x" format "messages": messages, "max_tokens": max_tokens, "temperature": anthropic_request.temperature, "stream": anthropic_request.stream, } - + + # Only include thinking field for Anthropic models + if anthropic_request.thinking and anthropic_request.model.startswith("anthropic/"): + litellm_request["thinking"] = anthropic_request.thinking + # Add optional parameters if present if anthropic_request.stop_sequences: litellm_request["stop"] = anthropic_request.stop_sequences