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

Code 404 for sending requests with images (stored in Google Storage) #255

Open
IagoRabelo opened this issue Sep 11, 2024 · 0 comments
Open
Assignees
Labels
component:js sdk Issue/PR related to JavaScript SDK status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working

Comments

@IagoRabelo
Copy link

Description of the bug:

I'm having trouble sending requests to analyze images hosted on Google Storage. Today my application already works with sending images converted to base64, however, when switching to the hosted image link, I encounter a 404 error.

Actual vs expected behavior:

My application currently works using the @google/generative-ai lib and the following methods:
`
const chatSession = model.startChat({
generationConfig,
history: context,
})

const resp = await chatSession.sendMessage(["Perform the analysis and answer the questions in the json format provided"])
`

It is currently working with a context in this format:
[ { "role": "user", "parts": [ { "text": "OCR_NF: [\nOCR reading content\n]" }, { "inlineData": { "data": "iVBORw0K....kJggg==", "mimeType": "image/png" } } ] } ]
However, now, changing it to read the file from Google Storage, it looks like this:
[ { "role": "user", "parts": [ { "text": "OCR_DOC: [\nOCR reading content\n]" }, { "fileData": { "fileUri": "gs://bucket_name/file_name.png", "mimeType": "image/png" } } ] } ]
However, the response is always a 404 code:
{ "response": { "status": 400, "statusText": "Bad Request" }, "verify": false }
Observations:

  1. The files are being saved correctly;
  2. The link was checked and is correct;
  3. It is within the same Gemini project;
  4. To save the file I am using the @google-cloud/storage lib with the methods: storage.bucket, bucket.upload;

First time posting here, I hope I was clear enough.

Any other information you'd like to share?

No response

@gmKeshari gmKeshari added type:bug Something isn't working status:triaged Issue/PR triaged to the corresponding sub-team component:js sdk Issue/PR related to JavaScript SDK labels Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:js sdk Issue/PR related to JavaScript SDK status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants