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

38 lines
1.3 KiB
Go
Raw Normal View History

2024-08-27 20:19:51 +08:00
package vertex
2025-03-03 20:06:08 +08:00
import (
2025-03-12 21:31:46 +08:00
"one-api/dto"
2025-03-03 20:06:08 +08:00
)
2024-08-27 20:19:51 +08:00
type VertexAIClaudeRequest struct {
2025-03-12 21:31:46 +08:00
AnthropicVersion string `json:"anthropic_version"`
Messages []dto.ClaudeMessage `json:"messages"`
System any `json:"system,omitempty"`
MaxTokens uint `json:"max_tokens,omitempty"`
StopSequences []string `json:"stop_sequences,omitempty"`
Stream bool `json:"stream,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
TopP float64 `json:"top_p,omitempty"`
TopK int `json:"top_k,omitempty"`
Tools any `json:"tools,omitempty"`
ToolChoice any `json:"tool_choice,omitempty"`
Thinking *dto.Thinking `json:"thinking,omitempty"`
2025-03-03 20:06:08 +08:00
}
2025-03-12 21:31:46 +08:00
func copyRequest(req *dto.ClaudeRequest, version string) *VertexAIClaudeRequest {
2025-03-03 20:06:08 +08:00
return &VertexAIClaudeRequest{
AnthropicVersion: version,
System: req.System,
Messages: req.Messages,
MaxTokens: req.MaxTokens,
Stream: req.Stream,
Temperature: req.Temperature,
TopP: req.TopP,
TopK: req.TopK,
StopSequences: req.StopSequences,
Tools: req.Tools,
ToolChoice: req.ToolChoice,
Thinking: req.Thinking,
}
2024-08-27 20:19:51 +08:00
}