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

streamUI and chatgpt: Failed after 3 attempts. Last error: Failed to process error response #1694

Closed
0xbohu opened this issue May 26, 2024 · 4 comments
Labels
ai/provider bug Something isn't working

Comments

@0xbohu
Copy link

0xbohu commented May 26, 2024

Description

I am using this template
https://vercel.com/templates/Next.js/nextjs-ai-chatbot

that uses streamUI from @ai-sdk/openai

const result = await streamUI({
    model: openai('gpt-3.5-turbo'),
    initial: <SpinnerMessage />,

Got error

⨯ ../core/util/retry-with-exponential-backoff.ts (51:13) @ _retryWithExponentialBackoff
 ⨯ AI_RetryError: Failed after 3 attempts. Last error: Failed to process error response
    at async $$ACTION_1 (./lib/chat/actions.tsx:178:20)
digest: "1632544603"
  49 |
  50 |     if (tryNumber > maxRetries) {
> 51 |       throw new RetryError({
     |             ^
  52 |         message: `Failed after ${tryNumber} attempts. Last error: ${errorMessage}`,
  53 |         reason: 'maxRetriesExceeded',
  54 |         errors: newErrors,
 POST / 500 in 6761ms

Code example

import 'server-only'
import {
  createAI,
  createStreamableUI,
  getMutableAIState,
  getAIState,
  streamUI,
  createStreamableValue
} from 'ai/rsc'
import { openai } from '@ai-sdk/openai'

const result = await streamUI({
    model: openai('gpt-3.5-turbo'),
    initial: <SpinnerMessage />,

Additional context

Have ChatGPT plus subscription, created a project API key and configured in this app. Also tried different mode:
"gpt-4o" but same error

@nicoalbanese
Copy link
Contributor

Hey! Sorry you're experiencing this error. Did you add credit to your OpenAI account? It doesn't look like ChatGPT plus subscription includes any credits towards the API as per: https://help.openai.com/en/articles/6950777-what-is-chatgpt-plus#h_e3d911c532

@0xbohu
Copy link
Author

0xbohu commented May 26, 2024

thank you @nicoalbanese that is the reason! I have added $10 to API usage and now it is working! have to create a new API key as well, as the old one also gives me insufficent_quota error

@lgrammel lgrammel added bug Something isn't working ai/provider labels May 26, 2024
@lgrammel lgrammel self-assigned this May 26, 2024
@lgrammel
Copy link
Collaborator

Keeping open, since there seems to be a potential problem parsing errors.

@lgrammel
Copy link
Collaborator

This is working on main. The OpenAI provider needs to be updated in the chatbot repo.

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