[Structured output type hints] Type returned after invoking llm.with_structured_output(PydanticClass, method="json_schema") is unknown instead of PydanticClass #28853
Unanswered
ai-learner-00
asked this question in
Q&A
Replies: 2 comments
-
Any updates on this? Having the same issue. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm wondering the same... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
I am using the method
llm.with_structured_output
to obtain an instance of a pydantic class. However, the type of the output is_DictOrPydantic[Unknown]
instead ofJoke
.I am wondering if there is an issue with the type hints:
For example, if I try to access

.setup
, I get a warningCannot access attribute "setup" for class "Dict[Unknown, Unknown]" Attribute "setup" is unknown
.System Info
langchain==0.3.9
langchain-community==0.3.8
langchain-core==0.3.21
langchain-openai==0.2.10
langchain-text-splitters==0.3.2
Windows WSL (dev container)
python 3.10
Beta Was this translation helpful? Give feedback.
All reactions