_parse_obj() — langchain Function Reference
Architecture documentation for the _parse_obj() function in pydantic.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD fd96632b_d191_0274_eb13_17083eb19c1d["_parse_obj()"] 570792b6_910c_5259_8419_5183ac1b1409["PydanticOutputParser"] fd96632b_d191_0274_eb13_17083eb19c1d -->|defined in| 570792b6_910c_5259_8419_5183ac1b1409 fd96632b_d191_0274_eb13_17083eb19c1d["_parse_obj()"] fd96632b_d191_0274_eb13_17083eb19c1d -->|calls| fd96632b_d191_0274_eb13_17083eb19c1d 832ab0e8_f54d_dc1d_0342_eccf5c13bd0d["parse_result()"] 832ab0e8_f54d_dc1d_0342_eccf5c13bd0d -->|calls| fd96632b_d191_0274_eb13_17083eb19c1d be3b196e_4a79_f447_3f29_9d15eee5575b["_parser_exception()"] fd96632b_d191_0274_eb13_17083eb19c1d -->|calls| be3b196e_4a79_f447_3f29_9d15eee5575b fd96632b_d191_0274_eb13_17083eb19c1d["_parse_obj()"] fd96632b_d191_0274_eb13_17083eb19c1d -->|calls| fd96632b_d191_0274_eb13_17083eb19c1d style fd96632b_d191_0274_eb13_17083eb19c1d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/output_parsers/pydantic.py lines 25–35
def _parse_obj(self, obj: dict) -> TBaseModel:
try:
if issubclass(self.pydantic_object, pydantic.BaseModel):
return self.pydantic_object.model_validate(obj)
if issubclass(self.pydantic_object, pydantic.v1.BaseModel):
return self.pydantic_object.parse_obj(obj)
msg = f"Unsupported model version for PydanticOutputParser: \
{self.pydantic_object.__class__}"
raise OutputParserException(msg)
except (pydantic.ValidationError, pydantic.v1.ValidationError) as e:
raise self._parser_exception(e, obj) from e
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _parse_obj() do?
_parse_obj() is a function in the langchain codebase, defined in libs/core/langchain_core/output_parsers/pydantic.py.
Where is _parse_obj() defined?
_parse_obj() is defined in libs/core/langchain_core/output_parsers/pydantic.py at line 25.
What does _parse_obj() call?
_parse_obj() calls 2 function(s): _parse_obj, _parser_exception.
What calls _parse_obj()?
_parse_obj() is called by 2 function(s): _parse_obj, parse_result.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free