llm: let a caller name its sampling temperature (V-490)
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.
This commit is contained in:
@@ -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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user