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

Function tool_stream_events

tests/test_open_telemetry.py:754–767  ·  view source on GitHub ↗

The events of `stream_events`, with a `tool_use` block after the text.

()

Source from the content-addressed store, hash-verified

752
753
754def tool_stream_events() -> list[dict[str, Any]]:
755 """The events of `stream_events`, with a `tool_use` block after the text."""
756 events = stream_events()
757 events[4:4] = [
758 {
759 "type": "content_block_start",
760 "index": 1,
761 "content_block": {"type": "tool_use", "id": "toolu_1", "name": "get_weather", "input": {}},
762 },
763 {"type": "content_block_delta", "index": 1, "delta": {"type": "input_json_delta", "partial_json": '{"city": '}},
764 {"type": "content_block_delta", "index": 1, "delta": {"type": "input_json_delta", "partial_json": '"SF"}'}},
765 {"type": "content_block_stop", "index": 1},
766 ]
767 return events
768
769
770TOOL_STREAM_OUTPUT: list[dict[str, Any]] = [

Calls 1

stream_eventsFunction · 0.85

Tested by

no test coverage detected