From bcc2305cd08649c97a925029cb3f9f34402cb54f Mon Sep 17 00:00:00 2001 From: claude Date: Mon, 3 Aug 2026 12:27:04 +0400 Subject: [PATCH] llm: let a caller name its sampling temperature (V-490) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The phraser's own transport has always sampled at 0.7 and this client has always been greedy. Routing a phrasing call through the client must not change how it decodes, so Req carries the temperature and 0 — the zero value, and what every existing caller wanted — is still greedy. --- internal/llm/client.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/llm/client.go b/internal/llm/client.go index e8293cc..c5a60c5 100644 --- a/internal/llm/client.go +++ b/internal/llm/client.go @@ -129,6 +129,11 @@ type Req struct { RepeatPenalty float64 // Stop — sequences that end generation early (e.g. newline for a one-liner). Stop []string + // Temperature — 0 (the zero value) is greedy decoding, and greedy is what + // every caller here wanted before this field existed. It is set only by the + // phraser, whose own transport has always sampled at 0.7: routing a phrasing + // call through this client must not quietly change how it decodes. + Temperature float64 } type msg struct { @@ -176,7 +181,7 @@ func (c *Client) Complete(ctx context.Context, r Req) (string, error) { Messages: []msg{{Role: "system", Content: r.System}, {Role: "user", Content: r.User}}, MaxTokens: r.MaxTokens, Grammar: r.Grammar, - Temp: 0, + Temp: r.Temperature, RepeatPenalty: r.RepeatPenalty, Stop: r.Stop, })