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

is_basemodel_type() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  6863d334_f818_2044_933f_386d7fd98f75["is_basemodel_type()"]
  3912cc3f_b0e8_a732_b8e2_613b018b830d["_models.py"]
  6863d334_f818_2044_933f_386d7fd98f75 -->|defined in| 3912cc3f_b0e8_a732_b8e2_613b018b830d
  68781e77_0c04_76c0_39da_f86210b5c63c["is_basemodel()"]
  68781e77_0c04_76c0_39da_f86210b5c63c -->|calls| 6863d334_f818_2044_933f_386d7fd98f75
  d05ec88e_2ca5_0a17_2c96_e788b0ef33ff["_build_discriminated_union_meta()"]
  d05ec88e_2ca5_0a17_2c96_e788b0ef33ff -->|calls| 6863d334_f818_2044_933f_386d7fd98f75
  style 6863d334_f818_2044_933f_386d7fd98f75 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_models.py lines 459–463

def is_basemodel_type(type_: type) -> TypeGuard[type[BaseModel] | type[GenericModel]]:
    origin = get_origin(type_) or type_
    if not inspect.isclass(origin):
        return False
    return issubclass(origin, BaseModel) or issubclass(origin, GenericModel)

Subdomains

Frequently Asked Questions

What does is_basemodel_type() do?
is_basemodel_type() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_models.py.
Where is is_basemodel_type() defined?
is_basemodel_type() is defined in src/anthropic/_models.py at line 459.
What calls is_basemodel_type()?
is_basemodel_type() is called by 2 function(s): _build_discriminated_union_meta, is_basemodel.

Analyze Your Own Codebase

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

Try Supermodel Free