From 3217d2738af345629e7da14c52fa4ee5cb288fe9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 18 Aug 2025 09:11:20 +0300 Subject: 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. --- internal/llm/copilot.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'internal/llm/copilot.go') 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 } -- cgit v1.2.3