-
Notifications
You must be signed in to change notification settings - Fork 234
Structured Output #895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
could you elaborate a little bit more, please? |
@lkuligin it seems (from the code and documentation) that structured output in langchain is only done by using an optional tool call (ie a tool that has the output schema) instead of forced structured output like the normal google genai SDK API. This is bad primarily because it gives the "ai" an option to not respond with the requested format. this happens a lot from my testing. |
@rek7 can you provde an example code that the output is not as instructed? So far I have used ChatGoogleGenerativeAI with Gemini 2.0 and 2.5 models with no issues with a Pydantic class. It would be great if you can provide a minimal reproducible example so we can hunt the issue down. |
@r0path @rek7 Have you tried to use "json_mode" as method?
|
i have tried this and found that it does not work for more complex models that include optional, union etc due to some kind of incompatibility with protobuf. Heres the error i get:
|
is anyone else experiencing issues with structured output not making use of the field description annotations? |
The native google SDK / api allows for structured output however langchain's implementation uses an optional tool. can we have it use this actual structured output (as supported by the API) instead of optional tool output? the current implementation makes usage of langchain / vertexai not usable for production.
The text was updated successfully, but these errors were encountered: