fix: record fallback routing metadata
Some checks failed
Browser smoke / browser-smoke (push) Has been cancelled
Tests / lint (push) Has been cancelled
Tests / test (3.11, 0) (push) Has been cancelled
Tests / test (3.11, 1) (push) Has been cancelled
Tests / test (3.11, 2) (push) Has been cancelled
Tests / test (3.12, 0) (push) Has been cancelled
Tests / test (3.12, 1) (push) Has been cancelled
Tests / test (3.12, 2) (push) Has been cancelled
Tests / test (3.13, 0) (push) Has been cancelled
Tests / test (3.13, 1) (push) Has been cancelled
Tests / test (3.13, 2) (push) Has been cancelled
Some checks failed
Browser smoke / browser-smoke (push) Has been cancelled
Tests / lint (push) Has been cancelled
Tests / test (3.11, 0) (push) Has been cancelled
Tests / test (3.11, 1) (push) Has been cancelled
Tests / test (3.11, 2) (push) Has been cancelled
Tests / test (3.12, 0) (push) Has been cancelled
Tests / test (3.12, 1) (push) Has been cancelled
Tests / test (3.12, 2) (push) Has been cancelled
Tests / test (3.13, 0) (push) Has been cancelled
Tests / test (3.13, 1) (push) Has been cancelled
Tests / test (3.13, 2) (push) Has been cancelled
This commit is contained in:
@@ -7307,6 +7307,27 @@ def _run_agent_streaming(
|
||||
requested_model=resolved_model or model,
|
||||
requested_provider=resolved_provider,
|
||||
)
|
||||
# Synthesize routing metadata from the agent's result when the
|
||||
# hermes fallback chain switched provider/model but didn't
|
||||
# populate llm_gateway_metadata (result carries 'model'/'provider',
|
||||
# not 'used_model'/'used_provider' that _extract_... expects).
|
||||
if not _gateway_routing and isinstance(result, dict):
|
||||
_result_model = result.get('model') or ''
|
||||
_result_provider = result.get('provider') or ''
|
||||
_req_model = resolved_model or model or ''
|
||||
_req_provider = resolved_provider or ''
|
||||
if (_result_model and _result_model != _req_model) or \
|
||||
(_result_provider and _req_provider and _result_provider != _req_provider):
|
||||
_gateway_routing = _normalize_gateway_routing_metadata(
|
||||
{
|
||||
'used_model': _result_model,
|
||||
'used_provider': _result_provider,
|
||||
'requested_model': _req_model,
|
||||
'requested_provider': _req_provider,
|
||||
},
|
||||
requested_model=_req_model,
|
||||
requested_provider=_req_provider,
|
||||
)
|
||||
if _gateway_routing:
|
||||
s.gateway_routing = _gateway_routing
|
||||
_history = list(getattr(s, 'gateway_routing_history', None) or [])
|
||||
|
||||
Reference in New Issue
Block a user