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

test_custom_input_schema_with_pydantic_model() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  1584a239_00ff_c896_678f_5dca6422b821["test_custom_input_schema_with_pydantic_model()"]
  e25ad18d_e1f6_726f_20bc_ac8e568d4e63["TestFunctionTool"]
  1584a239_00ff_c896_678f_5dca6422b821 -->|defined in| e25ad18d_e1f6_726f_20bc_ac8e568d4e63
  style 1584a239_00ff_c896_678f_5dca6422b821 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/lib/tools/test_functions.py lines 148–170

    def test_custom_input_schema_with_pydantic_model(self) -> None:
        class WeatherInput(BaseModel):
            location: str
            unit: str = "celsius"

        def get_weather(location: str, unit: str = "celsius") -> str:  # noqa: ARG001
            return f"Weather in {location}"

        # Pass the Pydantic model class directly as input_schema
        function_tool = beta_tool(get_weather, input_schema=WeatherInput)

        # Pydantic model schemas include additional metadata
        schema = function_tool.input_schema

        assert schema == {
            "title": "WeatherInput",
            "type": "object",
            "properties": {
                "location": {"title": "Location", "type": "string"},
                "unit": {"title": "Unit", "type": "string", "default": "celsius"},
            },
            "required": ["location"],
        }

Subdomains

Frequently Asked Questions

What does test_custom_input_schema_with_pydantic_model() do?
test_custom_input_schema_with_pydantic_model() is a function in the anthropic-sdk-python codebase, defined in tests/lib/tools/test_functions.py.
Where is test_custom_input_schema_with_pydantic_model() defined?
test_custom_input_schema_with_pydantic_model() is defined in tests/lib/tools/test_functions.py at line 148.

Analyze Your Own Codebase

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

Try Supermodel Free