fix thinking (@mettamatt)
This commit is contained in:
parent
e9c8cf8de6
commit
d63007d928
1 changed files with 7 additions and 3 deletions
|
|
@ -169,7 +169,7 @@ class Tool(BaseModel):
|
||||||
input_schema: Dict[str, Any]
|
input_schema: Dict[str, Any]
|
||||||
|
|
||||||
class ThinkingConfig(BaseModel):
|
class ThinkingConfig(BaseModel):
|
||||||
enabled: bool
|
enabled: bool = True
|
||||||
|
|
||||||
class MessagesRequest(BaseModel):
|
class MessagesRequest(BaseModel):
|
||||||
model: str
|
model: str
|
||||||
|
|
@ -539,13 +539,17 @@ def convert_anthropic_to_litellm(anthropic_request: MessagesRequest) -> Dict[str
|
||||||
|
|
||||||
# Create LiteLLM request dict
|
# Create LiteLLM request dict
|
||||||
litellm_request = {
|
litellm_request = {
|
||||||
"model": anthropic_request.model, # t understands "anthropic/claude-x" format
|
"model": anthropic_request.model, # it understands "anthropic/claude-x" format
|
||||||
"messages": messages,
|
"messages": messages,
|
||||||
"max_tokens": max_tokens,
|
"max_tokens": max_tokens,
|
||||||
"temperature": anthropic_request.temperature,
|
"temperature": anthropic_request.temperature,
|
||||||
"stream": anthropic_request.stream,
|
"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
|
# Add optional parameters if present
|
||||||
if anthropic_request.stop_sequences:
|
if anthropic_request.stop_sequences:
|
||||||
litellm_request["stop"] = anthropic_request.stop_sequences
|
litellm_request["stop"] = anthropic_request.stop_sequences
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue