Git Product home page Git Product logo

Comments (3)

TecEash1 avatar TecEash1 commented on September 26, 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.

from taurus.

TecEash1 avatar TecEash1 commented on September 26, 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

from taurus.

TecEash1 avatar TecEash1 commented on September 26, 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โ€

from taurus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.