fix: add thinking parameter to match claude-code request format
This commit is contained in:
parent
35878c0a92
commit
5989e9a390
2 changed files with 20 additions and 10 deletions
|
|
@ -14,6 +14,10 @@ func ConvertOpenAIRequest(req *ChatCompletionRequest) *AnthropicRequest {
|
||||||
Messages: convertMessages(remainingMessages),
|
Messages: convertMessages(remainingMessages),
|
||||||
System: system,
|
System: system,
|
||||||
MaxTokens: 32000,
|
MaxTokens: 32000,
|
||||||
|
Thinking: &AnthropicThinking{
|
||||||
|
Type: "enabled",
|
||||||
|
BudgetTokens: 10000,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.MaxTokens != nil {
|
if req.MaxTokens != nil {
|
||||||
|
|
|
||||||
26
types.go
26
types.go
|
|
@ -94,16 +94,22 @@ type FunctionCall struct {
|
||||||
// Anthropic Types
|
// Anthropic Types
|
||||||
|
|
||||||
type AnthropicRequest struct {
|
type AnthropicRequest struct {
|
||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
Messages []AnthropicMessage `json:"messages"`
|
Messages []AnthropicMessage `json:"messages"`
|
||||||
System string `json:"system,omitempty"`
|
System string `json:"system,omitempty"`
|
||||||
MaxTokens int `json:"max_tokens"`
|
MaxTokens int `json:"max_tokens"`
|
||||||
Stream bool `json:"stream,omitempty"`
|
Stream bool `json:"stream,omitempty"`
|
||||||
Temperature *float64 `json:"temperature,omitempty"`
|
Temperature *float64 `json:"temperature,omitempty"`
|
||||||
TopP *float64 `json:"top_p,omitempty"`
|
TopP *float64 `json:"top_p,omitempty"`
|
||||||
StopSequences []string `json:"stop_sequences,omitempty"`
|
StopSequences []string `json:"stop_sequences,omitempty"`
|
||||||
Tools []AnthropicTool `json:"tools,omitempty"`
|
Tools []AnthropicTool `json:"tools,omitempty"`
|
||||||
ToolChoice *AnthropicToolChoice `json:"tool_choice,omitempty"`
|
ToolChoice *AnthropicToolChoice `json:"tool_choice,omitempty"`
|
||||||
|
Thinking *AnthropicThinking `json:"thinking,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AnthropicThinking struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
BudgetTokens int `json:"budget_tokens,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AnthropicMessage struct {
|
type AnthropicMessage struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue