chroma icon indicating copy to clipboard operation
chroma copied to clipboard

[Bug]: 'Chroma' object has no attribute 'persist'

Open rachelshirin007 opened this issue 1 year ago • 1 comments

What happened?

I'm persisting the Chroma Database but it's giving me an error in jupyter notebook.

I'm basically redoing what's in this link.

https://github.com/hwchase17/chroma-langchain/blob/master/persistent-qa.ipynb

Is there any update in chromadb version and they have removed persist I don't get it.

!pip -q install chromadb openai langchain tiktoken

!pip install -q langchain-chroma

!pip install -q langchain_chroma  langchain_openai langchain_community

from langchain_chroma import Chroma
from langchain_openai import OpenAI
from langchain_community.embeddings import OpenAIEmbeddings
from langchain_community.document_loaders import TextLoader
from langchain_community.document_loaders import DirectoryLoader

persist_directory ='db'

embedding = OpenAIEmbeddings()

vectordb = Chroma.from_documents(documents=texts,
                                 embedding=embedding,
                                 persist_directory=persist_directory)

vectordb.persist()

Then I'm getting the below error:


AttributeError Traceback (most recent call last) Cell In[47], line 1 1 vectordb.persist()

AttributeError: 'Chroma' object has no attribute 'persist'

Versions

langchain-chroma 0.1.0 chromadb 0.4.24 Python 3.9.19 Windows 64-bit os

Relevant log output

No response

rachelshirin007 avatar Apr 13 '24 20:04 rachelshirin007

In 0.4.x, Chroma no longer supports the manual persistence method, so you should not be calling it if you use newer Chroma and LC. Don't worry your data is saved the moment the docs are added to Chroma with Chroma.from_documents.

tazarov avatar Apr 14 '24 05:04 tazarov