(cfg *config.Config, primary string, health map[string]bool)
| 157 | } |
| 158 | |
| 159 | func 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 | |
| 182 | func runRAGRetrieve(ctx context.Context, cfg *config.Config, req *types.AIRequest, ret map[string]interfaces.RetrievalAdapter, rerank interfaces.RerankAdapter) error { |
| 183 | kb := "" |
no test coverage detected