Home / Function/ test_pydantic_parser_validation() — langchain Function Reference

test_pydantic_parser_validation() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/output_parsers/test_pydantic_parser.py lines 66–81

def test_pydantic_parser_validation(pydantic_object: TypeBaseModel) -> None:
    bad_prompt = PromptTemplate(
        template="""{{
        "temperature": "oof",
        "f_or_c": 1,
        "forecast": "Sunny"
    }}""",
        input_variables=[],
    )

    model = ParrotFakeChatModel()

    parser = PydanticOutputParser[PydanticBaseModel](pydantic_object=pydantic_object)
    chain = bad_prompt | model | parser
    with pytest.raises(OutputParserException):
        chain.invoke({})

Domain

Subdomains

Frequently Asked Questions

What does test_pydantic_parser_validation() do?
test_pydantic_parser_validation() 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_validation() defined?
test_pydantic_parser_validation() is defined in libs/core/tests/unit_tests/output_parsers/test_pydantic_parser.py at line 66.

Analyze Your Own Codebase

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

Try Supermodel Free