Home / Function/ test_pydantic_parser_chaining() — langchain Function Reference

test_pydantic_parser_chaining() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/output_parsers/test_pydantic_parser.py lines 41–62

def test_pydantic_parser_chaining(
    pydantic_object: _FORECAST_MODELS_TYPES,
) -> None:
    prompt = PromptTemplate(
        template="""{{
        "temperature": 20,
        "f_or_c": "C",
        "forecast": "Sunny"
    }}""",
        input_variables=[],
    )

    model = ParrotFakeChatModel()

    parser = PydanticOutputParser[PydanticBaseModel](pydantic_object=pydantic_object)
    chain = prompt | model | parser

    res = chain.invoke({})
    assert isinstance(res, pydantic_object)
    assert res.f_or_c == "C"
    assert res.temperature == 20
    assert res.forecast == "Sunny"

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free