Home / Function/ test_json_parser_chaining() — langchain Function Reference

test_json_parser_chaining() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/output_parsers/test_pydantic_parser.py lines 86–106

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

    model = ParrotFakeChatModel()

    parser = JsonOutputParser(pydantic_object=pydantic_object)
    chain = prompt | model | parser

    res = chain.invoke({})
    assert res["f_or_c"] == "C"
    assert res["temperature"] == 20
    assert res["forecast"] == "Sunny"

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free