Home / Function/ to_raw_response_wrapper() — anthropic-sdk-python Function Reference

to_raw_response_wrapper() — anthropic-sdk-python Function Reference

Architecture documentation for the to_raw_response_wrapper() function in _response.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  e6c6e99b_0830_2196_ff22_f43c48578020["to_raw_response_wrapper()"]
  2e9c15bb_de03_aa91_93be_0e05db0a552e["_response.py"]
  e6c6e99b_0830_2196_ff22_f43c48578020 -->|defined in| 2e9c15bb_de03_aa91_93be_0e05db0a552e
  839eb1b8_70aa_074d_a52b_fad472cf23c5["get()"]
  e6c6e99b_0830_2196_ff22_f43c48578020 -->|calls| 839eb1b8_70aa_074d_a52b_fad472cf23c5
  style e6c6e99b_0830_2196_ff22_f43c48578020 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_response.py lines 777–791

def to_raw_response_wrapper(func: Callable[P, R]) -> Callable[P, APIResponse[R]]:
    """Higher order function that takes one of our bound API methods and wraps it
    to support returning the raw `APIResponse` object directly.
    """

    @functools.wraps(func)
    def wrapped(*args: P.args, **kwargs: P.kwargs) -> APIResponse[R]:
        extra_headers: dict[str, str] = {**(cast(Any, kwargs.get("extra_headers")) or {})}
        extra_headers[RAW_RESPONSE_HEADER] = "raw"

        kwargs["extra_headers"] = extra_headers

        return cast(APIResponse[R], func(*args, **kwargs))

    return wrapped

Subdomains

Calls

Frequently Asked Questions

What does to_raw_response_wrapper() do?
to_raw_response_wrapper() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_response.py.
Where is to_raw_response_wrapper() defined?
to_raw_response_wrapper() is defined in src/anthropic/_response.py at line 777.
What does to_raw_response_wrapper() call?
to_raw_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