_legacy_response.py — anthropic-sdk-python Source File
Architecture documentation for _legacy_response.py, a python file in the anthropic-sdk-python codebase. 29 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR f3a9224d_bdab_aa4b_9f5e_877302fb10bc["_legacy_response.py"] 87f621ac_b3e0_a225_72b3_99f9818f3002["_types.py"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> 87f621ac_b3e0_a225_72b3_99f9818f3002 0a69184e_7509_e793_afa4_1a03f37f5311["NoneType"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> 0a69184e_7509_e793_afa4_1a03f37f5311 6dadb144_3070_6111_357f_214554108905["__init__.py"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> 6dadb144_3070_6111_357f_214554108905 3912cc3f_b0e8_a732_b8e2_613b018b830d["_models.py"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> 3912cc3f_b0e8_a732_b8e2_613b018b830d 17ce5647_6f06_0676_a4a5_e378a3f57cb1["BaseModel"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> 17ce5647_6f06_0676_a4a5_e378a3f57cb1 68781e77_0c04_76c0_39da_f86210b5c63c["is_basemodel"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> 68781e77_0c04_76c0_39da_f86210b5c63c 11423f8f_08a1_b61d_0443_80db1a1d5485["add_request_id"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> 11423f8f_08a1_b61d_0443_80db1a1d5485 3d69c2f4_e6b6_2dd4_bdc8_383d4a3bc953["_constants.py"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> 3d69c2f4_e6b6_2dd4_bdc8_383d4a3bc953 8d141d22_ab1c_b4a1_744c_99e460d07454["_streaming.py"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> 8d141d22_ab1c_b4a1_744c_99e460d07454 3c15a36b_3b82_93a8_fe82_3d955b1934ca["Stream"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> 3c15a36b_3b82_93a8_fe82_3d955b1934ca 03fc0a8b_1c63_1aee_ef30_754aeebc2ff6["AsyncStream"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> 03fc0a8b_1c63_1aee_ef30_754aeebc2ff6 d418996b_1a10_4fe8_0fe5_007be2e08653["is_stream_class_type"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> d418996b_1a10_4fe8_0fe5_007be2e08653 941ce251_c4b2_51eb_76d8_a3a9127c15e5["extract_stream_chunk_type"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> 941ce251_c4b2_51eb_76d8_a3a9127c15e5 b3e43638_c882_dccb_b00e_ddc6b5147130["_exceptions.py"] f3a9224d_bdab_aa4b_9f5e_877302fb10bc --> b3e43638_c882_dccb_b00e_ddc6b5147130 style f3a9224d_bdab_aa4b_9f5e_877302fb10bc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from __future__ import annotations
import os
import inspect
import logging
import datetime
import functools
from typing import (
TYPE_CHECKING,
Any,
Union,
Generic,
TypeVar,
Callable,
Iterator,
AsyncIterator,
cast,
overload,
)
from typing_extensions import Awaitable, ParamSpec, override, deprecated, get_origin
import anyio
import httpx
import pydantic
from ._types import NoneType
from ._utils import is_given, extract_type_arg, is_annotated_type, is_type_alias_type
from ._models import BaseModel, is_basemodel, add_request_id
from ._constants import RAW_RESPONSE_HEADER
from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type
from ._exceptions import APIResponseValidationError
from ._decoders.jsonl import JSONLDecoder, AsyncJSONLDecoder
if TYPE_CHECKING:
from ._models import FinalRequestOptions
from ._base_client import BaseClient
P = ParamSpec("P")
R = TypeVar("R")
_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
log: logging.Logger = logging.getLogger(__name__)
class LegacyAPIResponse(Generic[R]):
"""This is a legacy class as it will be replaced by `APIResponse`
and `AsyncAPIResponse` in the `_response.py` file in the next major
release.
For the sync client this will mostly be the same with the exception
of `content` & `text` will be methods instead of properties. In the
async client, all methods will be async.
A migration script will be provided & the migration in general should
be smooth.
"""
_cast_to: type[R]
// ... (452 more lines)
Domain
Subdomains
Dependencies
- APIResponseValidationError
- AsyncStream
- BaseClient
- BaseModel
- FinalRequestOptions
- NoneType
- Stream
- __init__.py
- _base_client.py
- _constants.py
- _decoders.jsonl
- _exceptions.py
- _models.py
- _streaming.py
- _types.py
- add_request_id
- anyio
- datetime
- extract_stream_chunk_type
- functools
- httpx
- inspect
- is_basemodel
- is_stream_class_type
- logging
- os
- pydantic
- typing
- typing_extensions
Source
Frequently Asked Questions
What does _legacy_response.py do?
_legacy_response.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, SyncAPI subdomain.
What functions are defined in _legacy_response.py?
_legacy_response.py defines 3 function(s): _models, async_to_raw_response_wrapper, to_raw_response_wrapper.
What does _legacy_response.py depend on?
_legacy_response.py imports 29 module(s): APIResponseValidationError, AsyncStream, BaseClient, BaseModel, FinalRequestOptions, NoneType, Stream, __init__.py, and 21 more.
What files import _legacy_response.py?
_legacy_response.py is imported by 2 file(s): _base_client.py, _types.py.
Where is _legacy_response.py in the architecture?
_legacy_response.py is located at src/anthropic/_legacy_response.py (domain: AnthropicClient, subdomain: SyncAPI, directory: src/anthropic).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free