__stream__() — anthropic-sdk-python Function Reference
Architecture documentation for the __stream__() function in _beta_messages.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD c715fa82_5e69_b855_ef0e_47e7f518ade0["__stream__()"] 8e652b46_6f9a_daae_5db8_1aa0b9386626["BetaAsyncMessageStream"] c715fa82_5e69_b855_ef0e_47e7f518ade0 -->|defined in| 8e652b46_6f9a_daae_5db8_1aa0b9386626 a902fa3e_1643_6ad3_983d_fb2f08bc9b41["accumulate_event()"] c715fa82_5e69_b855_ef0e_47e7f518ade0 -->|calls| a902fa3e_1643_6ad3_983d_fb2f08bc9b41 3df97661_6baf_7419_93d1_ca34ae93ba17["build_events()"] c715fa82_5e69_b855_ef0e_47e7f518ade0 -->|calls| 3df97661_6baf_7419_93d1_ca34ae93ba17 style c715fa82_5e69_b855_ef0e_47e7f518ade0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/anthropic/lib/streaming/_beta_messages.py lines 280–291
async def __stream__(self) -> AsyncIterator[ParsedBetaMessageStreamEvent[ResponseFormatT]]:
async for sse_event in self._raw_stream:
self.__final_message_snapshot = accumulate_event(
event=sse_event,
current_snapshot=self.__final_message_snapshot,
request_headers=self.response.request.headers,
output_format=self.__output_format,
)
events_to_fire = build_events(event=sse_event, message_snapshot=self.current_message_snapshot)
for event in events_to_fire:
yield event
Domain
Subdomains
Source
Frequently Asked Questions
What does __stream__() do?
__stream__() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/lib/streaming/_beta_messages.py.
Where is __stream__() defined?
__stream__() is defined in src/anthropic/lib/streaming/_beta_messages.py at line 280.
What does __stream__() call?
__stream__() calls 2 function(s): accumulate_event, build_events.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free