Merge pull request #18 from rwrz/fix_thinking
fix thinking (@mettamatt)
This commit is contained in:
commit
08778097ee
1 changed files with 7 additions and 3 deletions
10
server.py
10
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue