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

default() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  f73e0710_f22c_8ab8_ec1c_fbe8e5e5057f["default()"]
  9ae2bf11_c83f_4579_f444_e2ce01769bf9["_CustomEncoder"]
  f73e0710_f22c_8ab8_ec1c_fbe8e5e5057f -->|defined in| 9ae2bf11_c83f_4579_f444_e2ce01769bf9
  style f73e0710_f22c_8ab8_ec1c_fbe8e5e5057f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_utils/_json.py lines 30–35

    def default(self, o: Any) -> Any:
        if isinstance(o, datetime):
            return o.isoformat()
        if isinstance(o, pydantic.BaseModel):
            return model_dump(o, exclude_unset=True, mode="json", by_alias=True)
        return super().default(o)

Subdomains

Frequently Asked Questions

What does default() do?
default() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_utils/_json.py.
Where is default() defined?
default() is defined in src/anthropic/_utils/_json.py at line 30.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free