(cfg *config.Config, req types.AIRequest, policyReason string, primary types.RouteDecision, exec types.ExecutionResult, requestID, traceID string)
| 223 | } |
| 224 | |
| 225 | func buildResponse(cfg *config.Config, req types.AIRequest, policyReason string, primary types.RouteDecision, exec types.ExecutionResult, requestID, traceID string) types.AIResponse { |
| 226 | chosenBackendCfg, _ := cfg.BackendByName(exec.BackendName) |
| 227 | latency := int64(0) |
| 228 | return types.AIResponse{ |
| 229 | RequestID: requestID, |
| 230 | TraceID: traceID, |
| 231 | RequestType: req.RequestType, |
| 232 | PipelineRef: req.PipelineRef, |
| 233 | SelectedBackend: exec.BackendName, |
| 234 | RouteReason: primary.Reason, |
| 235 | PolicyReason: policyReason, |
| 236 | EffectivePriority: req.Priority, |
| 237 | Status: exec.Status, |
| 238 | Result: exec.Output, |
| 239 | Metrics: types.AIMetrics{ |
| 240 | CompletionLatencyMs: latency, |
| 241 | EstimatedCost: chosenBackendCfg.Cost.Unit, |
| 242 | ServerReceivedAtUnix: time.Now().UnixMilli(), |
| 243 | }, |
| 244 | Fallback: types.FallbackState{Triggered: exec.UsedFallback}, |
| 245 | Degrade: types.DegradeState{}, |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | // NewDependenciesFromConfig builds policy/router/reliability for CLI replay. |
| 250 | func NewDependenciesFromConfig(cfg *config.Config, adapters map[string]interfaces.BackendAdapter, retrievalAdapters map[string]interfaces.RetrievalAdapter) Dependencies { |
no test coverage detected