Home / Function/ test_structured_prompt_pydantic() — langchain Function Reference

test_structured_prompt_pydantic() — langchain Function Reference

Architecture documentation for the test_structured_prompt_pydantic() function in test_structured.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  cb037627_89f7_2fb3_5c18_583347644c02["test_structured_prompt_pydantic()"]
  3513030b_4904_ecfd_7a0d_cc92be4dda69["test_structured.py"]
  cb037627_89f7_2fb3_5c18_583347644c02 -->|defined in| 3513030b_4904_ecfd_7a0d_cc92be4dda69
  style cb037627_89f7_2fb3_5c18_583347644c02 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_structured.py lines 41–57

def test_structured_prompt_pydantic() -> None:
    class OutputSchema(BaseModel):
        name: str
        value: int

    prompt = StructuredPrompt(
        [
            ("human", "I'm very structured, how about you?"),
        ],
        OutputSchema,
    )

    model = FakeStructuredChatModel(responses=[])

    chain = prompt | model

    assert chain.invoke({"hello": "there"}) == OutputSchema(name="yo", value=42)  # type: ignore[comparison-overlap]

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free