Wire retrying Provider into presets.FromSettings
FromSettings now returns llm.NewRetrying around the configured adapter, so every Provider it builds retries transient Generate failures and gets the default timeout; ListModels and Verify pass through. The test recording transport now answers 400 instead of failing the round trip: the ollama adapter reports a transport failure as ErrTimeout, which is retried, so the helper would see three requests. Tests: a 429 then 200 succeeds on the second request; exhausted retries return ErrProvider after MaxRetries+1 requests with no key in any error. Maestro task: 1a882923-fdb4-4576-ab82-9529e9974b26 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -178,13 +178,14 @@ var all = map[string]Preset{
|
||||
//
|
||||
// The Provider sends s.Temperature with every request whose Temperature is
|
||||
// nil; a request that sets one keeps it. Neither is sent to a model the
|
||||
// preset's OmitTemperature matches.
|
||||
// preset's OmitTemperature matches. It is wrapped in llm.NewRetrying, so
|
||||
// Generate retries transient vendor failures and has the default timeout.
|
||||
func FromSettings(s llm.Settings, key string) (llm.Provider, error) {
|
||||
cp, err := fromSettings(s, key)
|
||||
if err != nil {
|
||||
return nil, redact(err, key)
|
||||
}
|
||||
return cp, nil
|
||||
return llm.NewRetrying(cp), nil
|
||||
}
|
||||
|
||||
func fromSettings(s llm.Settings, key string) (*configured, error) {
|
||||
|
||||
Reference in New Issue
Block a user