model_dump() — anthropic-sdk-python Function Reference
Architecture documentation for the model_dump() function in _compat.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 99f35417_9c72_7af2_3e1d_6bc79dcd60df["model_dump()"] 5828b8ae_9c8c_9b95_9f29_d2659004d334["_compat.py"] 99f35417_9c72_7af2_3e1d_6bc79dcd60df -->|defined in| 5828b8ae_9c8c_9b95_9f29_d2659004d334 c1255cc8_bc9d_85e2_d7e7_d99e63ebb389["_build_request()"] c1255cc8_bc9d_85e2_d7e7_d99e63ebb389 -->|calls| 99f35417_9c72_7af2_3e1d_6bc79dcd60df 95c7e945_50f2_bb18_2948_bb6584934562["to_dict()"] 95c7e945_50f2_bb18_2948_bb6584934562 -->|calls| 99f35417_9c72_7af2_3e1d_6bc79dcd60df style 99f35417_9c72_7af2_3e1d_6bc79dcd60df fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/anthropic/_compat.py lines 140–165
def model_dump(
model: pydantic.BaseModel,
*,
exclude: IncEx | None = None,
exclude_unset: bool = False,
exclude_defaults: bool = False,
warnings: bool = True,
mode: Literal["json", "python"] = "python",
by_alias: bool | None = None,
) -> dict[str, Any]:
if (not PYDANTIC_V1) or hasattr(model, "model_dump"):
return model.model_dump(
mode=mode,
exclude=exclude,
exclude_unset=exclude_unset,
exclude_defaults=exclude_defaults,
# warnings are not supported in Pydantic v1
warnings=True if PYDANTIC_V1 else warnings,
by_alias=by_alias,
)
return cast(
"dict[str, Any]",
model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, by_alias=bool(by_alias)
),
)
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does model_dump() do?
model_dump() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_compat.py.
Where is model_dump() defined?
model_dump() is defined in src/anthropic/_compat.py at line 140.
What calls model_dump()?
model_dump() is called by 2 function(s): _build_request, to_dict.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free