Home / Function/ test_pydantic_output_parser_type_inference() — langchain Function Reference

test_pydantic_output_parser_type_inference() — langchain Function Reference

Architecture documentation for the test_pydantic_output_parser_type_inference() function in test_pydantic_parser.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  27e2fccd_4a9c_ece3_f32c_f7314d68a919["test_pydantic_output_parser_type_inference()"]
  70078932_b952_16ac_83c5_c9026d556e63["test_pydantic_parser.py"]
  27e2fccd_4a9c_ece3_f32c_f7314d68a919 -->|defined in| 70078932_b952_16ac_83c5_c9026d556e63
  style 27e2fccd_4a9c_ece3_f32c_f7314d68a919 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/output_parsers/test_pydantic_parser.py lines 168–188

def test_pydantic_output_parser_type_inference() -> None:
    """Test pydantic output parser type inference."""

    class SampleModel(BaseModel):
        foo: int
        bar: str

    # Ignoring mypy error that appears in python 3.8, but not 3.11.
    # This seems to be functionally correct, so we'll ignore the error.
    pydantic_parser = PydanticOutputParser[SampleModel](pydantic_object=SampleModel)
    schema = pydantic_parser.get_output_schema().model_json_schema()

    assert schema == {
        "properties": {
            "bar": {"title": "Bar", "type": "string"},
            "foo": {"title": "Foo", "type": "integer"},
        },
        "required": ["foo", "bar"],
        "title": "SampleModel",
        "type": "object",
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free