Home / Function/ test_pydantic_tools_parser_with_custom_title() — langchain Function Reference

test_pydantic_tools_parser_with_custom_title() — langchain Function Reference

Architecture documentation for the test_pydantic_tools_parser_with_custom_title() function in test_openai_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  bb8485f2_01c6_7008_b0ef_69c4822d250a["test_pydantic_tools_parser_with_custom_title()"]
  0f94a062_f577_31c7_fb9c_0f526b273e64["test_openai_tools.py"]
  bb8485f2_01c6_7008_b0ef_69c4822d250a -->|defined in| 0f94a062_f577_31c7_fb9c_0f526b273e64
  style bb8485f2_01c6_7008_b0ef_69c4822d250a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/output_parsers/test_openai_tools.py lines 989–1018

def test_pydantic_tools_parser_with_custom_title() -> None:
    """Test PydanticToolsParser with Pydantic v2 model using custom title."""

    class CustomTitleTool(BaseModel):
        """Tool with custom title in model config."""

        model_config = {"title": "MyCustomToolName"}

        value: int
        description: str

    # Test with custom title - tool should be callable by custom name
    parser = PydanticToolsParser(tools=[CustomTitleTool])
    message = AIMessage(
        content="",
        tool_calls=[
            {
                "id": "call_custom",
                "name": "MyCustomToolName",
                "args": {"value": 42, "description": "test"},
            }
        ],
    )
    generation = ChatGeneration(message=message)
    result = parser.parse_result([generation])

    assert len(result) == 1
    assert isinstance(result[0], CustomTitleTool)
    assert result[0].value == 42
    assert result[0].description == "test"

Domain

Subdomains

Frequently Asked Questions

What does test_pydantic_tools_parser_with_custom_title() do?
test_pydantic_tools_parser_with_custom_title() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/output_parsers/test_openai_tools.py.
Where is test_pydantic_tools_parser_with_custom_title() defined?
test_pydantic_tools_parser_with_custom_title() is defined in libs/core/tests/unit_tests/output_parsers/test_openai_tools.py at line 989.

Analyze Your Own Codebase

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

Try Supermodel Free