add_request_id() — anthropic-sdk-python Function Reference
Architecture documentation for the add_request_id() function in _models.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 11423f8f_08a1_b61d_0443_80db1a1d5485["add_request_id()"] 3912cc3f_b0e8_a732_b8e2_613b018b830d["_models.py"] 11423f8f_08a1_b61d_0443_80db1a1d5485 -->|defined in| 3912cc3f_b0e8_a732_b8e2_613b018b830d aad466e0_4b2d_aeb2_205c_df6bbaeef008["parse()"] aad466e0_4b2d_aeb2_205c_df6bbaeef008 -->|calls| 11423f8f_08a1_b61d_0443_80db1a1d5485 dc4c979e_1f25_e27f_cc3e_f1bcdc3b27d0["parse()"] dc4c979e_1f25_e27f_cc3e_f1bcdc3b27d0 -->|calls| 11423f8f_08a1_b61d_0443_80db1a1d5485 cd4d4a4e_4ea8_4346_3324_a03f797485c7["parse()"] cd4d4a4e_4ea8_4346_3324_a03f797485c7 -->|calls| 11423f8f_08a1_b61d_0443_80db1a1d5485 style 11423f8f_08a1_b61d_0443_80db1a1d5485 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/anthropic/_models.py lines 764–776
def add_request_id(obj: BaseModel, request_id: str | None) -> None:
obj._request_id = request_id
# in Pydantic v1, using setattr like we do above causes the attribute
# to be included when serializing the model which we don't want in this
# case so we need to explicitly exclude it
if PYDANTIC_V1:
try:
exclude_fields = obj.__exclude_fields__ # type: ignore
except AttributeError:
cast(Any, obj).__exclude_fields__ = {"_request_id", "__exclude_fields__"}
else:
cast(Any, obj).__exclude_fields__ = {*(exclude_fields or {}), "_request_id", "__exclude_fields__"}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does add_request_id() do?
add_request_id() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_models.py.
Where is add_request_id() defined?
add_request_id() is defined in src/anthropic/_models.py at line 764.
What calls add_request_id()?
add_request_id() is called by 3 function(s): parse, parse, parse.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free