diff options
| author | Paul Buetow <paul@buetow.org> | 2025-08-18 09:11:20 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-08-18 09:11:20 +0300 |
| commit | 3217d2738af345629e7da14c52fa4ee5cb288fe9 (patch) | |
| tree | 29381af9217aabc8fb9029225bfd7650e8f20717 /internal/llm/copilot.go | |
| parent | 041d1f140436c6fdd223844b04c6592c84951878 (diff) | |
feat(config): per-provider temperature defaults and docs\n\n- Add , , to config with coding-friendly default 0.2.\n- Wire defaults through providers (OpenAI, Copilot, Ollama).\n- Update CLI and LSP runners to pass configured temperatures.\n- Document temperature behavior and examples in README.\n- Update config.json.example to show new keys.
Diffstat (limited to 'internal/llm/copilot.go')
| -rw-r--r-- | internal/llm/copilot.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/internal/llm/copilot.go b/internal/llm/copilot.go index 680e7ec..47ce11e 100644 --- a/internal/llm/copilot.go +++ b/internal/llm/copilot.go @@ -22,6 +22,7 @@ type copilotClient struct { baseURL string defaultModel string chatLogger logging.ChatLogger + defaultTemperature *float64 } type copilotChatRequest struct { @@ -55,7 +56,7 @@ type copilotChatResponse struct { } // Constructor (kept among the first functions by convention) -func newCopilot(baseURL, model, apiKey string) Client { +func newCopilot(baseURL, model, apiKey string, defaultTemp *float64) Client { if strings.TrimSpace(baseURL) == "" { baseURL = "https://api.githubcopilot.com" } @@ -68,6 +69,7 @@ func newCopilot(baseURL, model, apiKey string) Client { baseURL: strings.TrimRight(baseURL, "/"), defaultModel: model, chatLogger: logging.NewChatLogger("copilot"), + defaultTemperature: defaultTemp, } } @@ -101,9 +103,12 @@ func (c copilotClient) Chat(ctx context.Context, messages []Message, opts ...Req for i, m := range messages { req.Messages[i] = copilotMessage{Role: m.Role, Content: m.Content} } - if o.Temperature != 0 { - req.Temperature = &o.Temperature - } + if o.Temperature != 0 { + req.Temperature = &o.Temperature + } else if c.defaultTemperature != nil { + t := *c.defaultTemperature + req.Temperature = &t + } if o.MaxTokens > 0 { req.MaxTokens = &o.MaxTokens } |
