Home / Function/ test_title_property_preserved() — langchain Function Reference

test_title_property_preserved() — langchain Function Reference

Architecture documentation for the test_title_property_preserved() function in test_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  90d4f065_000f_357e_346a_95bbf7a1a785["test_title_property_preserved()"]
  8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"]
  90d4f065_000f_357e_346a_95bbf7a1a785 -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555
  style 90d4f065_000f_357e_346a_95bbf7a1a785 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_tools.py lines 2806–2840

def test_title_property_preserved() -> None:
    """Test that the title property is preserved when generating schema.

    https://github.com/langchain-ai/langchain/issues/30456
    """
    schema_to_be_extracted = {
        "type": "object",
        "required": [],
        "properties": {
            "title": {"type": "string", "description": "item title"},
            "due_date": {"type": "string", "description": "item due date"},
        },
        "description": "foo",
    }

    @tool(args_schema=schema_to_be_extracted)
    def extract_data(extracted_data: dict[str, Any]) -> dict[str, Any]:
        """Some documentation."""
        return extracted_data

    assert convert_to_openai_tool(extract_data) == {
        "function": {
            "description": "Some documentation.",
            "name": "extract_data",
            "parameters": {
                "properties": {
                    "due_date": {"description": "item due date", "type": "string"},
                    "title": {"description": "item title", "type": "string"},
                },
                "required": [],
                "type": "object",
            },
        },
        "type": "function",
    }

Domain

Subdomains

Frequently Asked Questions

What does test_title_property_preserved() do?
test_title_property_preserved() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_title_property_preserved() defined?
test_title_property_preserved() is defined in libs/core/tests/unit_tests/test_tools.py at line 2806.

Analyze Your Own Codebase

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

Try Supermodel Free