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?