-
Notifications
You must be signed in to change notification settings - Fork 828
Support direct file URL for Gemini models on Vertex AI and GLA #1134
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
Edited title and description to reflect the fact that Gemini on the GLA does support the |
Using the gs uri with vertex-ai is also required to get timestamps for the audio. |
I believe I just hit this issue when trying to run an agent that includes the following against the ImageUrl(url="gs://bucket/path.png") which gave the error:
I have no opinion whether Thanks @vricciardulli for your ongoing work in #1136. I also found this prior issue that asked for something similar: from vertexai.generative_models import Part
video_file = Part.from_uri(
uri="gs://cloud-samples-data/generative-ai/video/pixel8.mp4",
mime_type="video/mp4",
) |
Description
NOTE: This feature request only applies to Gemini models, both on Vertex AI and, in minor measure, on GLA.
As stated in section Document Input of the documentation, documents are provided to Gemini models only as binary data. Users can accomplish this by using:
BinaryContent
: in which case users specify the binary data themselves.DocumentUrl
: in which case the document content is downloaded behind the scenes and then injected in the request body sent to Gemini.Gemini also supports direct file URL as user prompt, via field
fileData
. The structure for this field is already present in PydanticAI but currently unused.The benefits of supporting this type of user prompt are:
A downside that comes to mind is that this is a very specific case (only Gemini models and only the Vertex AI provider), which doesn't fit too well with the current implementation of PydanticAI, where the type of user prompt is general among providers and models. But this is just my opinion.
Thanks for taking the time to check this 🙏 I've also opened a PR to propose a straightforward implementation for this.
The text was updated successfully, but these errors were encountered: