Add temperature override option in config
- Add temperature field to Config struct (optional override)\n- Pass tempOverride to ConvertOpenAIRequest\n- Use override temperature if set, otherwise use client's temperature\n- Document option in config.yaml with example\n- Update README with temperature override documentation
This commit is contained in:
parent
cea246da83
commit
29292addac
5 changed files with 19 additions and 8 deletions
|
|
@ -7,7 +7,8 @@ import (
|
|||
)
|
||||
|
||||
// ConvertOpenAIRequest converts an OpenAI ChatCompletionRequest to Anthropic format
|
||||
func ConvertOpenAIRequest(req *ChatCompletionRequest) *AnthropicRequest {
|
||||
// tempOverride, if provided, overrides any temperature from the request
|
||||
func ConvertOpenAIRequest(req *ChatCompletionRequest, tempOverride *float64) *AnthropicRequest {
|
||||
system, remainingMessages := extractSystemMessage(req.Messages)
|
||||
|
||||
anthropicReq := &AnthropicRequest{
|
||||
|
|
@ -27,7 +28,10 @@ func ConvertOpenAIRequest(req *ChatCompletionRequest) *AnthropicRequest {
|
|||
if req.Stream != nil {
|
||||
anthropicReq.Stream = *req.Stream
|
||||
}
|
||||
if req.Temperature != nil {
|
||||
// Use temperature override if configured, otherwise use request temperature
|
||||
if tempOverride != nil {
|
||||
anthropicReq.Temperature = tempOverride
|
||||
} else if req.Temperature != nil {
|
||||
anthropicReq.Temperature = req.Temperature
|
||||
}
|
||||
if req.TopP != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue