I am trying to implement RAG with the GPT-3.5 api. However, my code execution gets stuck while trying to create the retriever. I didn’t get this issue on Google Colab but I started getting this issue once I shifted my codebase to my local environment.
Here is the function:
def create_retriever(docs_list,embeddings_model):
try:
text_splitter = TextSplitter((200,1000))
texts = [doc.page_content for doc in docs_list]
metadata_list = [doc.metadata for doc in docs_list]
print("INIT done!")
except Exception as e:
print("Error in split init: ",e)
try:
# Split the text and convert to Document objects
doc_splits = []
for i in range(len(texts)):
text = texts[i]
metadata = metadata_list[i]
chunks = text_splitter.chunks(text)
for chunk in chunks:
doc_splits.append(Document(page_content=chunk, metadata = metadata)) # can add the kind of code in metadata
print("SPLITTING done!")
except Exception as e:
print("Error in splitting: ",e)
try:
# Add to vectorDB
vectorstore = Chroma.from_documents(
documents=doc_splits,
collection_name="rag-chroma",
embedding=embeddings_model,
)
retriever = vectorstore.as_retriever()
print("Retriever created: ", retriever)
except Exception as e:
print("Error in creating the retriever object: ",e)
return retriever
The output that I get is as follows:
.
.
.
INIT done!
SPLITTING done!
INFO:backoff:Backing off send_request(…) for 0.5s (requests.exceptions.SSLError: HTTPSConnectionPool(host=’us-api.i.posthog.com’, port=443): Max retries exceeded with url: /batch/ (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1007)’))))
I have tried to re-install/upgrade my dependencies to their latest versions but to no avail.