-
Notifications
You must be signed in to change notification settings - Fork 163
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
What does "Key '$defs' is not supported in schema, ignoring" mean? #659
Comments
I've hit the same issue when doing the Langgraph Academy course in module 5 - I believe it occurs for me when using a nested schema in Trustcall with gemini-1.5-flash. Not sure if this is gemini / vertex ai related, as I've hit some other bugs throughout the course when running the provided notebooks without changing anything other than the model. One which I'll highlight is another one which I've not been able to solve and also relates to using Trustcall. Error: 'Key 'examples' is not supported in schema, ignoring' Circumstance: Using gemini-1.5-flash to update an existing collection using Trustcall
Schema: class Memory(BaseModel): class MemoryCollection(BaseModel): Unsolved: I think it is relating to gemini struggling to respond when the with_structured_output function, and it continuously generates the "example" field value which trustcall can't deal with. I've tried changing the trustcall prompt and putting the temperature to 0, both with no luck. |
As a note - been playing around and all of the errors I faced working with Gemini were solved completely when using OpenAI instead. |
Yes running the openai models works much better with the structured output. I however would like to know what the warning actually means when using the gemini models |
The issue is indeed with the nested pydantic model. Google/VertexAI doesn't support pydantic BaseModel directly and it is not even clear based on the documentation if they support complex nested types with structured output https://ai.google.dev/gemini-api/docs/structured-output?lang=python If you use pydantic BaseModel, this package converts it to a custom google schema using one of these functions
On the other hand, OpenAI documentation is pretty clear on using pydantic for nested definitions Code example
above code outputs
|
I keep getting
Key '$defs' is not supported in schema, ignoring
when I use gemini flash 1.5 with structured output but I can't seem to understand what the warning means. Cannot find anything on the web. Anyone knows? I think it might have something to do with nested pydantic modelsI use the
langchain-google-vertexai
pkg at version 2.0.9The text was updated successfully, but these errors were encountered: