MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / fallback_stream_events

Function fallback_stream_events

tests/test_open_telemetry.py:803–817  ·  view source on GitHub ↗

The events of `stream_events`, after a `fallback` block: another model serves the rest of the response.

()

Source from the content-addressed store, hash-verified

801
802
803def fallback_stream_events() -> list[dict[str, Any]]:
804 """The events of `stream_events`, after a `fallback` block: another model serves the rest of the response."""
805 fallback = {
806 "type": "fallback",
807 "from": {"model": "claude-test"},
808 "to": {"model": "claude-fallback"},
809 "trigger": {"type": "refusal", "category": None},
810 }
811 start, *rest = stream_events(index=1)
812 return [
813 start,
814 {"type": "content_block_start", "index": 0, "content_block": fallback},
815 {"type": "content_block_stop", "index": 0},
816 *rest,
817 ]
818
819
820def count_accumulated_events(monkeypatch: pytest.MonkeyPatch, *, beta: bool) -> list[str]:

Calls 1

stream_eventsFunction · 0.85

Tested by

no test coverage detected