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

_extract_field_schema_pv2() — anthropic-sdk-python Function Reference

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

Function python AnthropicClient SyncAPI calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  106e5427_56f3_c972_a573_f6852d1bf1e7["_extract_field_schema_pv2()"]
  3912cc3f_b0e8_a732_b8e2_613b018b830d["_models.py"]
  106e5427_56f3_c972_a573_f6852d1bf1e7 -->|defined in| 3912cc3f_b0e8_a732_b8e2_613b018b830d
  d05ec88e_2ca5_0a17_2c96_e788b0ef33ff["_build_discriminated_union_meta()"]
  d05ec88e_2ca5_0a17_2c96_e788b0ef33ff -->|calls| 106e5427_56f3_c972_a573_f6852d1bf1e7
  afc80c40_7ec9_e8a7_8063_f2ab74bc2ee7["get()"]
  106e5427_56f3_c972_a573_f6852d1bf1e7 -->|calls| afc80c40_7ec9_e8a7_8063_f2ab74bc2ee7
  style 106e5427_56f3_c972_a573_f6852d1bf1e7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_models.py lines 727–745

def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None:
    schema = model.__pydantic_core_schema__
    if schema["type"] == "definitions":
        schema = schema["schema"]

    if schema["type"] != "model":
        return None

    schema = cast("ModelSchema", schema)
    fields_schema = schema["schema"]
    if fields_schema["type"] != "model-fields":
        return None

    fields_schema = cast("ModelFieldsSchema", fields_schema)
    field = fields_schema["fields"].get(field_name)
    if not field:
        return None

    return cast("ModelField", field)  # pyright: ignore[reportUnnecessaryCast]

Subdomains

Calls

Frequently Asked Questions

What does _extract_field_schema_pv2() do?
_extract_field_schema_pv2() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_models.py.
Where is _extract_field_schema_pv2() defined?
_extract_field_schema_pv2() is defined in src/anthropic/_models.py at line 727.
What does _extract_field_schema_pv2() call?
_extract_field_schema_pv2() calls 1 function(s): get.
What calls _extract_field_schema_pv2()?
_extract_field_schema_pv2() is called by 1 function(s): _build_discriminated_union_meta.

Analyze Your Own Codebase

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

Try Supermodel Free