test_structured_prompt_kwargs() — langchain Function Reference
Architecture documentation for the test_structured_prompt_kwargs() function in test_structured.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e8c7d980_9212_b371_2da0_bdf60c6ef6d8["test_structured_prompt_kwargs()"] 3513030b_4904_ecfd_7a0d_cc92be4dda69["test_structured.py"] e8c7d980_9212_b371_2da0_bdf60c6ef6d8 -->|defined in| 3513030b_4904_ecfd_7a0d_cc92be4dda69 style e8c7d980_9212_b371_2da0_bdf60c6ef6d8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/prompts/test_structured.py lines 87–121
def test_structured_prompt_kwargs() -> None:
prompt = StructuredPrompt(
[
("human", "I'm very structured, how about you?"),
],
{
"name": "yo",
"description": "a structured output",
"parameters": {
"name": {"type": "string"},
"value": {"type": "integer"},
},
},
value=7,
)
model = FakeStructuredChatModel(responses=[])
chain = prompt | model
assert chain.invoke({"hello": "there"}) == {"name": 1, "value": 7} # type: ignore[comparison-overlap]
assert loads(dumps(prompt)).model_dump() == prompt.model_dump()
chain = loads(dumps(prompt)) | model
assert chain.invoke({"hello": "there"}) == {"name": 1, "value": 7}
class OutputSchema(BaseModel):
name: str
value: int
prompt = StructuredPrompt(
[("human", "I'm very structured, how about you?")], OutputSchema, value=7
)
model = FakeStructuredChatModel(responses=[])
chain = prompt | model
assert chain.invoke({"hello": "there"}) == OutputSchema(name="yo", value=7) # type: ignore[comparison-overlap]
Domain
Subdomains
Source
Frequently Asked Questions
What does test_structured_prompt_kwargs() do?
test_structured_prompt_kwargs() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/prompts/test_structured.py.
Where is test_structured_prompt_kwargs() defined?
test_structured_prompt_kwargs() is defined in libs/core/tests/unit_tests/prompts/test_structured.py at line 87.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free