Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Image/File Viewing Support #9

Open
TecEash1 opened this issue Mar 10, 2024 · 3 comments
Open

[FEATURE] Image/File Viewing Support #9

TecEash1 opened this issue Mar 10, 2024 · 3 comments
Assignees
Labels
enhancement Development on an existing feature feature Completely new feature or request P1 Priority High

Comments

@TecEash1
Copy link
Owner

TecEash1 commented Mar 10, 2024

📂 What category is this feature in?

AI

📝 Description of Feature

Allow support for images/files to be passed to model along with text.

This is possible because of Googles Gemini Pro 1.5 Model

Discord supports all of the mime types and fetching them for images. It is specified under content in attachments in the message object. Some mime types are different between Gemini and Discord so a converter will need to be made.

This update should add support to unlock all of Gemini 1.5s Multimodal capabilities:

  • Images
  • Audio
  • Videos
  • Plain text
@TecEash1 TecEash1 added the enhancement Development on an existing feature label Mar 10, 2024
@TecEash1 TecEash1 self-assigned this Mar 10, 2024
@TecEash1 TecEash1 changed the title [FEATURE] Google Pro Vision Model Support [FEATURE] Google Gemini Pro Vision Model Support Mar 10, 2024
@TecEash1 TecEash1 added the feature Completely new feature or request label Mar 10, 2024
@TecEash1 TecEash1 changed the title [FEATURE] Google Gemini Pro Vision Model Support [FEATURE] Image/File Viewing Support Apr 11, 2024
@TecEash1
Copy link
Owner Author

TecEash1 commented May 6, 2024

Relevant example docs:
https://github.com/google-gemini/generative-ai-js/blob/main/samples/node/file-upload.js
https://github.com/google-gemini/cookbook/blob/main/quickstarts/file-api/sample.js

This method was just introduced to the Google Generative AI npm package recently, so was not possible before.
The bot should auto detect what the mime_type is, it should support image files and utf-8 encoded text files. It should also potentially support other file types such as .pdf, and maybe videos eventually.

@TecEash1
Copy link
Owner Author

TecEash1 commented May 7, 2024

This commit adds file viewing support. However the file is not uploaded directly and is instead made into a string. This issue will stay open until Image/Files are uploaded properly

@TecEash1
Copy link
Owner Author

TecEash1 commented May 9, 2024

Relevant example docs: https://github.com/google-gemini/generative-ai-js/blob/main/samples/node/file-upload.js https://github.com/google-gemini/cookbook/blob/main/quickstarts/file-api/sample.js

This method was just introduced to the Google Generative AI npm package recently, so was not possible before. The bot should auto detect what the mime_type is, it should support image files and utf-8 encoded text files. It should also potentially support other file types such as .pdf, and maybe videos eventually.

When this feature is added to the GoogleGenerativeAI package work on this will begin.
This is due to the package relying on a local file parameter at the moment, however discord returns a file link to be utilised. In the case that this file URL option is not added to the package a workaround to this will be made by temporarily storing the file locally.

Update: Due to there being no definitive date when the feature will come to the API the update will most likely include downloading all of the users files locally and uploading them to the FileAPI.

For history - Function modification needed to fetch mime type from file and upload it, and pass an array of file ids to the handleGeminiResponse function.
For running - With the file ids and mime types to go in the inline data along with any that may be from history it can be passed into the model for the request, after the request has been sent the files should be deleted as the FileAPI has a 20GB limit that is cleared every 48 hours.

Additional notes:
Should, in the rare case that the users files amount to more than 20GB or there has been a failure with uploading their files the model should be passed a message along with the system instruction or users message saying “The user tried to upload a file, unfortunately the 20GB file limit was reached or uploading failed, please take this into account when replying”

@TecEash1 TecEash1 added the P1 Priority High label May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Development on an existing feature feature Completely new feature or request P1 Priority High
Projects
Status: Todo
Development

No branches or pull requests

1 participant