MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _begin_attempt_trace

Function _begin_attempt_trace

uncommon_route/proxy.py:4770–4798  ·  view source on GitHub ↗
(
            attempt_payload: dict[str, Any],
            *,
            fallback_from: str | None = None,
        )

Source from the content-addressed store, hash-verified

4768 current_attempt_trace: dict[str, Any] | None = None
4769
4770 def _begin_attempt_trace(
4771 attempt_payload: dict[str, Any],
4772 *,
4773 fallback_from: str | None = None,
4774 ) -> None:
4775 nonlocal current_attempt_trace
4776 provider_name = ""
4777 if attempt_payload.get("provider_entry") is not None:
4778 provider_name = str(getattr(attempt_payload["provider_entry"], "name", "") or "")
4779 current_attempt_trace = {
4780 "attempt_index": len(attempts_payload) + 1,
4781 "selected_model": attempt_payload["selected_model"],
4782 "resolved_model": attempt_payload["resolved_model"],
4783 "provider_name": provider_name,
4784 "target_url": attempt_payload["target_chat_url"],
4785 "requested_transport": attempt_payload["transport_decision"].requested_transport,
4786 "transport": attempt_payload["transport_decision"].selected_transport,
4787 "transport_reason": attempt_payload["transport_decision"].reason,
4788 "transport_preference_source": attempt_payload["transport_decision"].preference_source,
4789 "cache_mode": _cache_mode_name(attempt_payload["cache_plan"]),
4790 "cache_family": _cache_family_name(attempt_payload["cache_plan"]),
4791 "cache_breakpoints": attempt_payload["cache_plan"].cache_breakpoints,
4792 "fallback_from": fallback_from or "",
4793 "status_code": 0,
4794 "success": False,
4795 "error_code": "",
4796 "error_message": "",
4797 }
4798 attempts_payload.append(current_attempt_trace)
4799
4800 def _complete_attempt_trace(
4801 *,

Callers 2

_select_stream_responseFunction · 0.85
_handle_chat_coreFunction · 0.85

Calls 4

_cache_mode_nameFunction · 0.85
_cache_family_nameFunction · 0.85
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected