mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-13 08:52:02 +00:00
fix(proxy): keep the top-level model on the Responses fallback metadata event
This commit is contained in:
parent
8207f98112
commit
756d4df1cd
2 changed files with 7 additions and 1 deletions
|
|
@ -9918,7 +9918,11 @@ def _format_fallback_metadata_sse_event(
|
|||
) -> str | bytes:
|
||||
litellm_fallback: Final = {"fallback_model": fallback_model, "errors": fallback_errors}
|
||||
if error_state is not None:
|
||||
event: Final = {"type": _RESPONSES_FALLBACK_METADATA_EVENT_TYPE, "litellm_fallback": litellm_fallback}
|
||||
event: Final = {
|
||||
"type": _RESPONSES_FALLBACK_METADATA_EVENT_TYPE,
|
||||
"model": fallback_model or "",
|
||||
"litellm_fallback": litellm_fallback,
|
||||
}
|
||||
error_state.observe_chunk(event)
|
||||
return error_state.mark_emitted(f"data: {json.dumps(event)}\n\n")
|
||||
payload: Final = {
|
||||
|
|
|
|||
|
|
@ -952,8 +952,10 @@ async def test_responses_stream_sends_fallback_metadata_as_a_typed_event_framed_
|
|||
)
|
||||
assert payloads[1] == {
|
||||
"type": "litellm.fallback_metadata",
|
||||
"model": "fallback-model",
|
||||
"litellm_fallback": {"fallback_model": "fallback-model", "errors": fallback_errors},
|
||||
}
|
||||
assert {payload.get("model") for payload in payloads} == {"fallback-model"}
|
||||
assert len({frame.startswith("event: ") for frame in event_frames}) == 1
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue