client
client copied to clipboard
feat: add new MIME types supported by latest models
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
- Added support for creating
FilePartinstances 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
ModelNameenum, based on the official Gemini API documentation.