async_to_streamed_response_wrapper() — anthropic-sdk-python Function Reference
Architecture documentation for the async_to_streamed_response_wrapper() function in _response.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 4b2ca855_9ac3_d35b_7bf4_65542dfcce2b["async_to_streamed_response_wrapper()"] 2e9c15bb_de03_aa91_93be_0e05db0a552e["_response.py"] 4b2ca855_9ac3_d35b_7bf4_65542dfcce2b -->|defined in| 2e9c15bb_de03_aa91_93be_0e05db0a552e afc80c40_7ec9_e8a7_8063_f2ab74bc2ee7["get()"] 4b2ca855_9ac3_d35b_7bf4_65542dfcce2b -->|calls| afc80c40_7ec9_e8a7_8063_f2ab74bc2ee7 style 4b2ca855_9ac3_d35b_7bf4_65542dfcce2b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/anthropic/_response.py lines 706–724
def async_to_streamed_response_wrapper(
func: Callable[P, Awaitable[R]],
) -> Callable[P, AsyncResponseContextManager[AsyncAPIResponse[R]]]:
"""Higher order function that takes one of our bound API methods and wraps it
to support streaming and returning the raw `APIResponse` object directly.
"""
@functools.wraps(func)
def wrapped(*args: P.args, **kwargs: P.kwargs) -> AsyncResponseContextManager[AsyncAPIResponse[R]]:
extra_headers: dict[str, str] = {**(cast(Any, kwargs.get("extra_headers")) or {})}
extra_headers[RAW_RESPONSE_HEADER] = "stream"
kwargs["extra_headers"] = extra_headers
make_request = func(*args, **kwargs)
return AsyncResponseContextManager(cast(Awaitable[AsyncAPIResponse[R]], make_request))
return wrapped
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does async_to_streamed_response_wrapper() do?
async_to_streamed_response_wrapper() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_response.py.
Where is async_to_streamed_response_wrapper() defined?
async_to_streamed_response_wrapper() is defined in src/anthropic/_response.py at line 706.
What does async_to_streamed_response_wrapper() call?
async_to_streamed_response_wrapper() calls 1 function(s): get.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free