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
13
handler.go
13
handler.go
|
|
@ -12,15 +12,16 @@ import (
|
|||
)
|
||||
|
||||
type ModelConfig struct {
|
||||
ID string `yaml:"id"`
|
||||
OwnedBy string `yaml:"owned_by"`
|
||||
ID string `yaml:"id"`
|
||||
OwnedBy string `yaml:"owned_by"`
|
||||
}
|
||||
|
||||
// Config holds the application configuration
|
||||
type Config struct {
|
||||
Port int `yaml:"port"`
|
||||
UpstreamURL string `yaml:"upstream_url"`
|
||||
Models []ModelConfig `yaml:"models"`
|
||||
Port int `yaml:"port"`
|
||||
UpstreamURL string `yaml:"upstream_url"`
|
||||
Models []ModelConfig `yaml:"models"`
|
||||
Temperature *float64 `yaml:"temperature,omitempty"`
|
||||
}
|
||||
|
||||
var config *Config
|
||||
|
|
@ -124,7 +125,7 @@ func handleChatCompletions(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
// Convert to Anthropic format — always non-streaming to upstream
|
||||
// (ZAI's streaming returns empty for GLM models)
|
||||
anthropicReq := ConvertOpenAIRequest(&req)
|
||||
anthropicReq := ConvertOpenAIRequest(&req, config.Temperature)
|
||||
anthropicReq.Stream = false
|
||||
|
||||
reqBody, _ := json.Marshal(anthropicReq)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue