MCPcopy Create free account
hub / github.com/docker/docker-agent / WithFallbackModel

Function WithFallbackModel

pkg/agent/opts.go:65–69  ·  view source on GitHub ↗

WithFallbackModel adds a fallback model to try if the primary model fails. For retryable errors (5xx, timeouts), the same model is retried with backoff. For non-retryable errors (429), we immediately move to the next model in the chain.

(model provider.Provider)

Source from the content-addressed store, hash-verified

63// For retryable errors (5xx, timeouts), the same model is retried with backoff.
64// For non-retryable errors (429), we immediately move to the next model in the chain.
65func WithFallbackModel(model provider.Provider) Opt {
66 return func(a *Agent) {
67 a.fallbackModels = append(a.fallbackModels, model)
68 }
69}
70
71// WithFallbackRetries sets the number of retries per fallback model with exponential backoff.
72func WithFallbackRetries(retries int) Opt {

Calls

no outgoing calls