Skip to content

Conversation

@marmor7
Copy link
Contributor

@marmor7 marmor7 commented Nov 20, 2025

  • Added example code for file uploads and inline usage with Gemini GLA.
  • Clarified Google GLA file upload option

Update docs following PR:
#2270

I moved the Google GLA bullet above Google Vertex, because the inlined section that was vertex-specific did not seem inlined in the final doc, so it made the Google GLA bullet feel out of place:

Screenshot 2025-11-20 at 16 53 57

- Added example code for file uploads and inline usage with Gemini GLA.
- Clarified Google GLA file upload option
@dsfaccini
Copy link
Contributor

hey @marmor7 thank you for the PR, I left two comments on the code but wanted to give you some pointers as well

Firstly, you created the PR from the github UI, so you can't really review what your changes are gonna look like on the docs

  • it'd be advisable that you clone the repository and locally preview the docs after you've made changes to them, just as a sanity check

Secondly, your code examples use variables that aren't defined in the example. Generally, it's a good practice to provide examples that run "as is", i.e., the user can copy the example and run it without needing to find out, e.g., where the mimetype comes from. This would be caught by CI if the code blocks weren't marked to skip linting.

One thing in the example you provided for passing a file in-line, is you used the variable file_bytes, which may make people reading it think they need to file_bytes = Path('filepath.txt').read_bytes(), but if the google genai API expects a base64 encoded string, that's not going to work.

@marmor7
Copy link
Contributor Author

marmor7 commented Nov 23, 2025

thanks @dsfaccini
I've ran the docs-site locally it looks ok.

I've made the two code samples complete as requested.

in the upload version I've switched to the more clear and concise:
file = client.files.upload(file='path/to/document.pdf')

and for the inline version:
file_bytes = Path('path/to/document.pdf').read_bytes()
(yes, it handles file_bytes without base64 encoding)

BTW, you've mentioned you added comments in the code, I didn't see them, did you submit your review?

@dsfaccini
Copy link
Contributor

hey @marmor7, thank you for the changes, a couple of notes:

  • the example's still using the google.genai client instead of agent.model.client
  • from pydantic_ai.messages import BinaryContent is unnecessary, you can import directly from pydantic_ai import BinaryContent
  • you're setting the mimetype explicitly but users don't always know how to set the mimetype, so it would be nice to use guess_type in the example so users don't have to struggle with it
  • the title and the wording on the - file uploaded would still need updating

BTW you're right I added the comments but never started the review, sorry for that. I've submitted the review now.

@marmor7
Copy link
Contributor Author

marmor7 commented Nov 25, 2025

@dsfaccini i fixed all your comments (with the exception of guess_type)

and I think it's now good enough to get merged, but CI is failing for some reason, even though all checks that actually ran were successful.

docs/input.md Outdated

- [`GoogleModel`][pydantic_ai.models.google.GoogleModel] on GLA: YouTube video URLs are sent directly in the request to the model.
## Example code for Gemini GLA

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still needs updating the title to sth like "Uploaded files"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought you meant the header one line below which now reads "Use uploaded files" as you suggested.
for the header above "Example code for Gemini GLA", it doesn't make sense to change to "Uploaded files" as i'm providing two separate code examples, one for uploaded files and one for inlined files.

@DouweM
Copy link
Collaborator

DouweM commented Nov 26, 2025

@marmor7 Thanks! I've made a few tweaks because parts of these docs were outdated, and I've created a new related issue: #3569

@DouweM DouweM changed the title Update Google GLA file docs + example code Update docs on multi-modal file URLs being downloaded or sent directly Nov 26, 2025
@DouweM DouweM merged commit 6bdd39b into pydantic:main Nov 26, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants