- Notifications
You must be signed in to change notification settings - Fork1k
Description
Question
I am currently using the google.genai API (and the Files API) directly and would like to switch over to Pydantic-AI, but I'd like to know if there is a way/workaround to make my use case work.
For context, I am running prompts for image analysis that include 20-30 images each (~15 image examples, ~ 5-15 images to analyze). For prompt tuning and performance testing, I run batches of e.g. 1000 test cases repeatedly. This causes the following issues:
- Uploading images takes a significant amount of time, slowing down experiments
- Image examples would get uploaded repeatedly (I could cache the prompt, but see below)
- The doc states the file API should be used if the total prompt size is over 20mb (seehttps://ai.google.dev/gemini-api/docs/files)
To solve these issues, I use the Files API and manage (on my end) when to upload a file vs when to get it from cache (the File objects themselves are lightweight). I can replace all the images in my prompt with File objects, which speeds up my tests significantly, because I upload the files once, then can test multiple times during the time the files are cached.
As I understand it, the File API is not supported. Is there a way I could achieve something similar (e.g. pass the File objects somehow)?
Thanks
Additional Context
No response