chroma icon indicating copy to clipboard operation
chroma copied to clipboard

Index not found after using it

Open aymanek opened this issue 2 years ago • 3 comments

I used chromadb to embed and index some data, but randomly after being used, I started getting Index not found :

WARNING:root:Collection langchain already exists, Do you have the right embedding function? DEBUG:Chroma:Index not found

while it was there and everything was working smoothly, i also checked the persistent directory, the 'chroma-embeddings.parquet' file size changed to 17X bytes

aymanek avatar Apr 12 '23 10:04 aymanek

@aymanestr can you share more code and/or a repro?

jeffchuber avatar Apr 12 '23 17:04 jeffchuber

These are the two snipets i'm using to do the Q/A and the embedding : def get_answer(folder, query: str) -> Dict[str, Any]: # Get the answer embeddings = OpenAIEmbeddings() db=Chroma(persist_directory=folder, embedding_function=embeddings) count = db._collection.count() chain_type_kwargs = {"prompt": PROMPT} if count < 4: qa = VectorDBQA.from_chain_type(llm=OpenAI(temperature=0.5) , chain_type="stuff", k=count, vectorstore=db, return_source_documents=True, chain_type_kwargs=chain_type_kwargs) answer = qa(query) print(answer) else: qa = VectorDBQA.from_chain_type(llm=OpenAI(temperature=0.5) , chain_type="stuff", vectorstore=db, return_source_documents=True, chain_type_kwargs=chain_type_kwargs) answer = qa(query) return answer def embed_docs(docs ,docname: str, user_id: str): """Embeds a list of Documents and returns a Chromadb index""" try: doc_id = uuid.uuid4() persist_directory = doc_id fold = os.path.join(os.getcwd(), persist_directory) if not os.path.exists(fold): os.makedirs(fold) embeddings = OpenAIEmbeddings() db = Chroma.from_documents(docs, embeddings, persist_directory=persist_directory) return persist_directory except Exception as e: print(e)

aymanek avatar Apr 12 '23 23:04 aymanek

DEBUG:Chroma:Index not found DEBUG:Chroma:Index saved to {self._save_folder}/index.bin DEBUG:Chroma:Index saved to {self._save_folder}/index.bin

aymanek avatar Apr 13 '23 07:04 aymanek

@aymanestr were you able to resolve this? closing this for now but happy to re-open

jeffchuber avatar May 08 '23 17:05 jeffchuber