(r: RouteRecord)
| 636 | |
| 637 | |
| 638 | def _record_payload(r: RouteRecord) -> dict[str, Any]: |
| 639 | return { |
| 640 | "timestamp": r.timestamp, |
| 641 | "requested_model": r.requested_model, |
| 642 | "mode": r.mode, |
| 643 | "model": r.model, |
| 644 | "tier": _normalize_tier_label(r.tier), |
| 645 | "decision_tier": _normalize_tier_label(r.decision_tier) if r.decision_tier else "", |
| 646 | "served_quality": _normalize_served_quality(r.served_quality), |
| 647 | "served_quality_target": _normalize_served_quality(r.served_quality_target), |
| 648 | "served_quality_floor": _normalize_served_quality(r.served_quality_floor), |
| 649 | "capability_lane": str(r.capability_lane or "").strip().lower(), |
| 650 | "confidence": r.confidence, |
| 651 | "raw_confidence": r.raw_confidence, |
| 652 | "confidence_source": r.confidence_source, |
| 653 | "calibration_version": r.calibration_version, |
| 654 | "calibration_sample_count": r.calibration_sample_count, |
| 655 | "calibration_temperature": r.calibration_temperature, |
| 656 | "calibration_applied_tags": list(r.calibration_applied_tags or []), |
| 657 | "method": r.method, |
| 658 | "estimated_cost": r.estimated_cost, |
| 659 | "baseline_cost": r.baseline_cost, |
| 660 | "actual_cost": r.actual_cost, |
| 661 | "savings": r.savings, |
| 662 | "latency_us": r.latency_us, |
| 663 | "usage_input_tokens": r.usage_input_tokens, |
| 664 | "usage_output_tokens": r.usage_output_tokens, |
| 665 | "cache_read_input_tokens": r.cache_read_input_tokens, |
| 666 | "cache_write_input_tokens": r.cache_write_input_tokens, |
| 667 | "cache_hit_ratio": r.cache_hit_ratio, |
| 668 | "transport": r.transport, |
| 669 | "cache_mode": r.cache_mode, |
| 670 | "cache_family": r.cache_family, |
| 671 | "cache_breakpoints": r.cache_breakpoints, |
| 672 | "input_tokens_before": r.input_tokens_before, |
| 673 | "input_tokens_after": r.input_tokens_after, |
| 674 | "artifacts_created": r.artifacts_created, |
| 675 | "compacted_messages": r.compacted_messages, |
| 676 | "semantic_summaries": r.semantic_summaries, |
| 677 | "semantic_calls": r.semantic_calls, |
| 678 | "semantic_failures": r.semantic_failures, |
| 679 | "semantic_quality_fallbacks": r.semantic_quality_fallbacks, |
| 680 | "checkpoint_created": r.checkpoint_created, |
| 681 | "rehydrated_artifacts": r.rehydrated_artifacts, |
| 682 | "sidechannel_estimated_cost": r.sidechannel_estimated_cost, |
| 683 | "sidechannel_actual_cost": r.sidechannel_actual_cost, |
| 684 | "session_id": r.session_id, |
| 685 | "turn_id": r.turn_id, |
| 686 | "step_type": r.step_type, |
| 687 | "fallback_reason": r.fallback_reason, |
| 688 | "streaming": r.streaming, |
| 689 | "request_id": r.request_id, |
| 690 | "prompt_preview": r.prompt_preview, |
| 691 | "complexity": r.complexity, |
| 692 | "route_reasoning": r.route_reasoning, |
| 693 | "constraint_tags": list(r.constraint_tags or []), |
| 694 | "hint_tags": list(r.hint_tags or []), |
| 695 | "feature_tags": list(r.feature_tags or []), |
no test coverage detected