client icon indicating copy to clipboard operation
client copied to clipboard

feat: add new MIME types supported by latest models

Open Hugobsan opened this issue 8 months ago • 1 comments

New MIME Types Supported

Since the release of Gemini 2.0 Flash, several new MIME types have been supported. However, they were not yet added to the MimeType enum. Since building a FilePart for a request requires a valid MimeType enum instance, I decided to investigate.

After reviewing the official Gemini model documentation, I wrote a test script to try different file types and included all supported types in the enum.

Notes

Some MIME types like application/x-javascript and application/x-python were rejected by gemini-2.0-flash during testing. However, they have been preserved in the enum to maintain backwards compatibility with existing SDK users.

Output from my tests

MIME_Types_Test.csv

Hugobsan avatar Apr 13 '25 15:04 Hugobsan

  • Added support for creating FilePart instances using MIME types or strings. This improves flexibility and prevents issues when new MIME types are introduced before the SDK is updated.
  • Added newly released models to the ModelName enum, based on the official Gemini API documentation.

Hugobsan avatar Apr 13 '25 16:04 Hugobsan