Files
new-api/relay/channel/aws/dto.go

37 lines
1.3 KiB
Go
Raw Normal View History

2024-04-23 11:44:40 +08:00
package aws
2024-10-24 00:19:08 +08:00
import (
2025-03-12 21:31:46 +08:00
"one-api/dto"
2024-10-24 00:19:08 +08:00
)
2024-04-23 11:44:40 +08:00
type AwsClaudeRequest struct {
// AnthropicVersion should be "bedrock-2023-05-31"
2025-03-12 21:31:46 +08:00
AnthropicVersion string `json:"anthropic_version"`
System any `json:"system,omitempty"`
Messages []dto.ClaudeMessage `json:"messages"`
MaxTokens uint `json:"max_tokens,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
TopP float64 `json:"top_p,omitempty"`
TopK int `json:"top_k,omitempty"`
StopSequences []string `json:"stop_sequences,omitempty"`
Tools any `json:"tools,omitempty"`
ToolChoice any `json:"tool_choice,omitempty"`
Thinking *dto.Thinking `json:"thinking,omitempty"`
2024-04-23 11:44:40 +08:00
}
2024-11-14 15:12:34 +08:00
2025-03-12 21:31:46 +08:00
func copyRequest(req *dto.ClaudeRequest) *AwsClaudeRequest {
2024-11-14 15:12:34 +08:00
return &AwsClaudeRequest{
AnthropicVersion: "bedrock-2023-05-31",
System: req.System,
Messages: req.Messages,
MaxTokens: req.MaxTokens,
Temperature: req.Temperature,
TopP: req.TopP,
TopK: req.TopK,
StopSequences: req.StopSequences,
Tools: req.Tools,
ToolChoice: req.ToolChoice,
Thinking: req.Thinking,
2024-11-14 15:12:34 +08:00
}
}