0

I am trying to follow a Langchain tutorial. The code below:

from langchain.document_loaders import WebBaseLoader
from langchain.indexes import VectorstoreIndexCreator

# Load document from web (blogpost)
loader = WebBaseLoader("https://lilianweng.github.io/posts/2023-06-23-agent/")

data = loader.load()

# Split the text
from langchain.text_splitter import RecursiveCharacterTextSplitter
text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=0)
all_splits = text_splitter.split_documents(data)

# Embed and store the splits in a vector db (chroma)
from langchain.vectorstores import Chroma
from langchain.embeddings import OpenAIEmbeddings
vectorstore = Chroma.from_documents(documents=all_splits, embedding=OpenAIEmbeddings())

question = "what are the approaches to task decomposition"
docs = vectorstore.similarity_search(question)
print(len(docs))

I keep getting the following error trace:

Retrying langchain.embeddings.openai.embed_with_retry.<locals>._embed_with_retry in 4.0 seconds as it raised RateLimitError: You exceeded your current quota, please check your plan and billing details..

The API is not allowing even a single request to go through. So, the RateLimitError is confusing.

Is there something which needs to be optimized in my code, or is there a workaround/fix for this?

Dawny33
  • 10,543
  • 21
  • 82
  • 134
  • Does this answer your question? [OpenAI ChatGPT (GPT-3.5) API error 429: "You exceeded your current quota, please check your plan and billing details"](https://stackoverflow.com/questions/75898276/openai-chatgpt-gpt-3-5-api-error-429-you-exceeded-your-current-quota-please) – Rok Benko Jul 26 '23 at 11:07
  • 1
    @RokBenko Yes. That answers my question. Upgrading the account to a paid plan by setting up a payment option solved the problem. – Dawny33 Jul 26 '23 at 11:19

1 Answers1

0

I referred to this forum post about a similar issue. The solution seem to be adding a payment mode to the OpenAI account, which makes it a paid account.

Once the account gets converted to a paid account, the RateLimitError stopped popping up, and the requests are getting processed fine.

Dawny33
  • 10,543
  • 21
  • 82
  • 134