-
Notifications
You must be signed in to change notification settings - Fork 144
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
Does Google Gemini support Vizro-AI? #871
Comments
Dear @richizo , thank you so much for your message! This is indeed an interesting error. On the surface I cannot tell immediately whether the bug lies with from langchain_google_genai import (
ChatGoogleGenerativeAI,
)
from pydantic.v1 import BaseModel
llm = ChatGoogleGenerativeAI(model="gemini-1.5-flash", safety_settings=safety_settings)
class User(BaseModel):
name: str
age: int
pydantic_llm = llm.with_structured_output(User)
pydantic_llm.invoke("Jon is 23 years old") I do need to jump, can only look again tomorrow, but could you seem if you can locate more what argument/situation might be causing this? |
A quick search is showing that this might be similarly occurring for others:
If you could dig a bit deeper here that would be amazing, otherwise I'll try to take a look tomorrow |
Dear @richizo, sorry for taking a bit longer to reply, it was a bit hectic on my side. There seems to be an bug on the Google API side in that it cannot properly read a schema produced by pydantic V1 (which we still use, but we are changing that as we speak). The following code shows that if you uncomment the from langchain_google_genai import (
ChatGoogleGenerativeAI,
)
from pydantic.v1 import BaseModel
llm = ChatGoogleGenerativeAI(model="gemini-1.5-pro")
class User(BaseModel):
name: str
age: int
# hobbies: list[str]
pydantic_llm = llm.with_structured_output(User)
pydantic_llm.invoke("Jon is 23 years old and he plays guitar and reads books") Now further testing suggests that this is not the case for Pydantic V2, so if you change the import to just
@antonymilne FYI - this is further support :) |
Question
I'm trying to follow the example given on Vizro-AI homepage, but instead of using the OpenAI model I switched to the Google Gemini.
But I'm getting the error bellow.
Error:
Stacktrace:
Python: 3.10
vizro: 0.1.26
vizro_ai: 0.3.2
langchain: 0.2.17
langchain_core: 0.2.43
langchain_google_genai: 1.0.10
langgraph: 0.2.16
langsmith: 0.1.142
Code/Examples
Which package?
vizro-ai
Code of Conduct
The text was updated successfully, but these errors were encountered: