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

Gemini getting error sometimes #3775

Open
capkakitiga opened this issue Nov 19, 2024 · 4 comments
Open

Gemini getting error sometimes #3775

capkakitiga opened this issue Nov 19, 2024 · 4 comments
Labels
ai/provider bug Something isn't working

Comments

@capkakitiga
Copy link

capkakitiga commented Nov 19, 2024

Description

⨯ Error [AI_APICallError]: * GenerateContentRequest.contents[2].parts: contents.parts must not be empty.

  • GenerateContentRequest.contents[5].parts: contents.parts must not be empty.

  • GenerateContentRequest.contents[8].parts: contents.parts must not be empty.

  • GenerateContentRequest.contents[11].parts: contents.parts must not be empty.

  • GenerateContentRequest.contents[14].parts: contents.parts must not be empty.

    at (/var/task/.next/server/app/(chat)/api/chat/route.js:36:4984)
    at async em (/var/task/.next/server/app/(chat)/api/chat/route.js:36:2111)
    at async ex.doStream (/var/task/.next/server/app/(chat)/api/chat/route.js:36:10963)
    at async fn (/var/task/.next/server/app/(chat)/api/chat/route.js:44:45816)
    at async (/var/task/.next/server/app/(chat)/api/chat/route.js:44:3458)
    at async tc (/var/task/.next/server/app/(chat)/api/chat/route.js:44:1504)
    at async s (/var/task/.next/server/app/(chat)/api/chat/route.js:44:44955)
    at async fn (/var/task/.next/server/app/(chat)/api/chat/route.js:44:48173)
    at async (/var/task/.next/server/app/(chat)/api/chat/route.js:44:3458) {
    cause: undefined,
    url: 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-pro-latest:streamGenerateContent?alt=sse',
    requestBodyValues: [Object],
    statusCode: 400,
    responseHeaders: [Object],
    responseBody: '{\n' +
    ' "error": {\n' +
    ' "code": 400,\n' +
    ' "message": "* GenerateContentRequest.contents[2].parts: contents.parts must not be empty.\n* GenerateContentRequest.contents[5].parts: contents.parts must not be empty.\n* GenerateContentRequest.contents[8].parts: contents.parts must not be empty.\n* GenerateContentRequest.contents[11].parts: contents.parts must not be empty.\n* GenerateContentRequest.contents[14].parts: contents.parts must not be empty.\n",\n' +
    ' "status": "INVALID_ARGUMENT"\n' +
    ' }\n' +
    '}\n',
    isRetryable: false,
    data: [Object]
    }

Code example

No response

AI provider

@ai-sdk/google 0.0.23

Additional context

Idk whats wrong with this

@capkakitiga capkakitiga added the bug Something isn't working label Nov 19, 2024
@lgrammel
Copy link
Collaborator

@ai-sdk/[email protected] is fairly old. Can you update to 1.0.0 and see if the error still happens?

@capkakitiga
Copy link
Author

@ai-sdk/[email protected] is fairly old. Can you update to 1.0.0 and see if the error still happens?

sorry my bad it was "@ai-sdk/google": "^1.0.0",

@capkakitiga
Copy link
Author

payload_gemini_error.json

here is the payload

@hossdar
Copy link

hossdar commented Dec 1, 2024

Confirming that with the latest release "@ai-sdk/google": "^1.0.4" and "ai": "^4.0.9".

I'm getting error when switching to another model in the same chat, only if a Gemini model is involved.
No errors when switching back and forth among Grok or OpenAI models.. run smoothly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/provider bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants