Home / Function/ test_pydantic_tools_parser_name_dict_fallback() — langchain Function Reference

test_pydantic_tools_parser_name_dict_fallback() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/output_parsers/test_openai_tools.py lines 1021–1047

def test_pydantic_tools_parser_name_dict_fallback() -> None:
    """Test that name_dict properly falls back to __name__ when title is None."""

    class ToolWithoutTitle(BaseModel):
        """Tool without explicit title."""

        data: str

    # Ensure model_config doesn't have a title or it's None
    # (This is the default behavior)
    parser = PydanticToolsParser(tools=[ToolWithoutTitle])
    message = AIMessage(
        content="",
        tool_calls=[
            {
                "id": "call_no_title",
                "name": "ToolWithoutTitle",
                "args": {"data": "test_data"},
            }
        ],
    )
    generation = ChatGeneration(message=message)
    result = parser.parse_result([generation])

    assert len(result) == 1
    assert isinstance(result[0], ToolWithoutTitle)
    assert result[0].data == "test_data"

Domain

Subdomains

Frequently Asked Questions

What does test_pydantic_tools_parser_name_dict_fallback() do?
test_pydantic_tools_parser_name_dict_fallback() 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_name_dict_fallback() defined?
test_pydantic_tools_parser_name_dict_fallback() is defined in libs/core/tests/unit_tests/output_parsers/test_openai_tools.py at line 1021.

Analyze Your Own Codebase

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

Try Supermodel Free