Skip to content

Conversation

@Florian-BACHO
Copy link
Contributor

@Florian-BACHO Florian-BACHO commented Oct 27, 2025

Description

So far, the GoogleGenAI LLM accepted a use_file_api boolean to choose whether uploading large files via FileAPI is allowed or not. This PR changes this parameter to a file_mode that can accept 3 possible values for more control over file uploads:

  • inline: to only allow inline files
  • fileapi: to only allow FileAPI uploads
  • hybrid: to allow both (inline for files smaller than 20MB and FileAPI for larger files)

I also updated the chat_message_to_gemini and create_file_part:

  • I removed an unnecessary bytes-to-BytesIO convertion
  • Files uploaded with FileAPI can now have their FPS changed, which was not the case with the previous behavior
  • Names of files uploaded with FileAPI are now returned for later deletion (as File objects are not part of the content anymore, we need to keep track of the file names to delete)

Version Bump?

Did I bump the version in the pyproject.toml file of the package I am updating? (Except for the llama-index-core package)

  • Yes
  • No

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Your pull-request will likely not be merged unless it is covered by some form of impactful unit testing.

  • I added new unit tests to cover this change
  • I believe this change is already covered by existing unit tests

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added Google Colab support for the newly added notebooks.
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I ran uv run make format; uv run make lint to appease the lint gods

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 27, 2025
@Florian-BACHO Florian-BACHO changed the title Change use_file_api to file_mode Change GoogleGenAI use_file_api to file_mode Oct 27, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Oct 27, 2025
@Florian-BACHO Florian-BACHO changed the title Change GoogleGenAI use_file_api to file_mode Change GoogleGenAI use_file_api to file_mode and allow FPS with FileAPI Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant