test_parse_with_different_pydantic_2_proper() — langchain Function Reference
Architecture documentation for the test_parse_with_different_pydantic_2_proper() function in test_openai_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 1e3f802a_bf0a_279d_f9f5_ce650b74337e["test_parse_with_different_pydantic_2_proper()"] 0f94a062_f577_31c7_fb9c_0f526b273e64["test_openai_tools.py"] 1e3f802a_bf0a_279d_f9f5_ce650b74337e -->|defined in| 0f94a062_f577_31c7_fb9c_0f526b273e64 style 1e3f802a_bf0a_279d_f9f5_ce650b74337e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/output_parsers/test_openai_tools.py lines 844–874
def test_parse_with_different_pydantic_2_proper() -> None:
"""Test with pydantic.BaseModel from pydantic 2."""
class Forecast(BaseModel):
temperature: int
forecast: str
# Can't get pydantic to work here due to the odd typing of tryig to support
# both v1 and v2 in the same codebase.
parser = PydanticToolsParser(tools=[Forecast])
message = AIMessage(
content="",
tool_calls=[
{
"id": "call_OwL7f5PE",
"name": "Forecast",
"args": {"temperature": 20, "forecast": "Sunny"},
}
],
)
generation = ChatGeneration(
message=message,
)
assert parser.parse_result([generation]) == [
Forecast(
temperature=20,
forecast="Sunny",
)
]
Domain
Subdomains
Source
Frequently Asked Questions
What does test_parse_with_different_pydantic_2_proper() do?
test_parse_with_different_pydantic_2_proper() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/output_parsers/test_openai_tools.py.
Where is test_parse_with_different_pydantic_2_proper() defined?
test_parse_with_different_pydantic_2_proper() is defined in libs/core/tests/unit_tests/output_parsers/test_openai_tools.py at line 844.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free