Skip to content

Documentation: Get Started code snippet: OpenAI returns 429 error #9956

@TaMaN2031A

Description

@TaMaN2031A

Describe the bug
While exploring the haystack documentation, I began by executing the code on the Get Started page. When executing the code, OpenAI returned an error indicating that I don't have enough quota to run this query.

Error message
haystack.core.errors.PipelineRuntimeError: The following component failed to run:
Component name: 'llm'
Component type: 'OpenAIChatGenerator'
Error: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}

Expected behavior
The code should run without errors, especially because this is the Hello World of haystack, and not all the people who are trying it for the first time have a quota on OpenAI, or want to spend it on the Hello World script of a platform they are still discovering.

Additional context
A solution could be to update the documentation by using another free cloud provider available in haystack, so that the code runs smoothly and users can get the expected responses without hitting OpenAI’s quota limits.
I tried HuggingFaceAPIChatGenerator from the documentation, and it worked, but I had to install "huggingface_hub[inference]>=0.27.0

To Reproduce
Run the code with an OPEN_API_KEY of a free-tier account on OpenAI.

FAQ Check

System:

  • OS: WSL2 Ubuntu on Windows 11
  • GPU/CPU: Not necessary
  • Haystack version (commit or version number): 2.19.0
  • DocumentStore: InMemoryDocumentStore
  • Reader: Doesn't exist in the code
  • Retriever: InMemoryBM25Retriever

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priority, leave it in the backlog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions