MCPcopy Index your code
hub / github.com/docker/docker-agent / buildModelChain

Function buildModelChain

pkg/runtime/fallback.go:74–89  ·  view source on GitHub ↗

buildModelChain returns the ordered list of models to try: primary first, then fallbacks.

(primary provider.Provider, fallbacks []provider.Provider)

Source from the content-addressed store, hash-verified

72
73// buildModelChain returns the ordered list of models to try: primary first, then fallbacks.
74func buildModelChain(primary provider.Provider, fallbacks []provider.Provider) []modelWithFallback {
75 chain := make([]modelWithFallback, 0, 1+len(fallbacks))
76 chain = append(chain, modelWithFallback{
77 provider: primary,
78 isFallback: false,
79 index: -1,
80 })
81 for i, fb := range fallbacks {
82 chain = append(chain, modelWithFallback{
83 provider: fb,
84 isFallback: true,
85 index: i,
86 })
87 }
88 return chain
89}
90
91// logFallbackAttempt logs information about a fallback attempt
92func logFallbackAttempt(agentName string, model modelWithFallback, attempt, maxRetries int, err error) {

Callers 2

TestBuildModelChainFunction · 0.85
executeMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestBuildModelChainFunction · 0.68