这是indexloc提供的服务,不要输入任何密码
Skip to content

[BUG]: Unhandled Anthropic error #1046

@timothycarambat

Description

@timothycarambat

How are you running AnythingLLM?

Not listed

What happened?

When a key is rate limited the user sends a chat there is an unhandled Anthropic error.

Reproduction log

 Found 1 pinned sources - prepending to content with ~29725 tokens of content.
/home/ubuntu/anything-llm/server/node_modules/@anthropic-ai/sdk/error.js:58
            return new RateLimitError(status, error, message, headers);
                   ^

RateLimitError: 429 {"type":"error","error":{"type":"rate_limit_error","message":"Number of request tokens has exceeded your rate limit (https://docs.anthropic.com/claude/reference/rate-limits). Please reduce the the prompt length or the maximum tokens requested, or try again later. You may also contact sales at https://www.anthropic.com/contact-sales to discuss your options for a rate limit increase."}}
    at APIError.generate (/home/ubuntu/anything-llm/server/node_modules/@anthropic-ai/sdk/error.js:58:20)
    at Anthropic.makeStatusError (/home/ubuntu/anything-llm/server/node_modules/@anthropic-ai/sdk/core.js:263:33)
    at Anthropic.makeRequest (/home/ubuntu/anything-llm/server/node_modules/@anthropic-ai/sdk/core.js:306:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async MessageStream._createMessage (/home/ubuntu/anything-llm/server/node_modules/@anthropic-ai/sdk/lib/MessageStream.js:114:24) {
  status: 429,
  headers: {
    'anthropic-ratelimit-requests-limit': '5',
    'anthropic-ratelimit-requests-remaining': '4',
    'anthropic-ratelimit-requests-reset': '2024-04-05T16:09:00Z',
    'anthropic-ratelimit-tokens-limit': '300000',
    'anthropic-ratelimit-tokens-remaining': '0',
    'anthropic-ratelimit-tokens-reset': '2024-04-06T00:00:00Z',
   ....
  },
  error: {
    type: 'error',
    error: {
      type: 'rate_limit_error',
      message: 'Number of request tokens has exceeded your rate limit (https://docs.anthropic.com/claude/reference/rate-limits). Please reduce the the prompt length or the maximum tokens requested, or try again later. You may also contact sales at https://www.anthropic.com/contact-sales to discuss your options for a rate limit increase.'
    }
  }
}

Are there known steps to reproduce?

Send a chat on a rate limited Anthropic key that sends more text then the key allows.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions