MCPcopy Create free account
hub / github.com/InferCore/InferCore / buildFallbackList

Function buildFallbackList

internal/replay/replay.go:159–180  ·  view source on GitHub ↗
(cfg *config.Config, primary string, health map[string]bool)

Source from the content-addressed store, hash-verified

157}
158
159func buildFallbackList(cfg *config.Config, primary string, health map[string]bool) []types.RouteDecision {
160 // Mirror server.buildFallback logic via router package helper would duplicate; inline minimal.
161 var out []types.RouteDecision
162 for _, rule := range cfg.Reliability.FallbackRules {
163 if rule.FromBackend != primary {
164 continue
165 }
166 backendCfg, ok := cfg.BackendByName(rule.FallbackTo)
167 if !ok {
168 continue
169 }
170 if !router.BackendHealthOK(health, backendCfg.Name) {
171 continue
172 }
173 out = append(out, types.RouteDecision{
174 BackendName: backendCfg.Name,
175 Reason: "fallback-from-" + primary,
176 EstimatedCost: backendCfg.Cost.Unit,
177 })
178 }
179 return out
180}
181
182func runRAGRetrieve(ctx context.Context, cfg *config.Config, req *types.AIRequest, ret map[string]interfaces.RetrievalAdapter, rerank interfaces.RerankAdapter) error {
183 kb := ""

Callers 1

replayCurrentFunction · 0.85

Calls 2

BackendHealthOKFunction · 0.92
BackendByNameMethod · 0.80

Tested by

no test coverage detected