Skip to content

Commit

Permalink
be backwards compatible
Browse files Browse the repository at this point in the history
jeffchuber committed Jul 20, 2023
1 parent 5c65add commit 6fadde6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions gptcache/manager/vector_data/chroma.py
Original file line number Diff line number Diff line change
@@ -39,9 +39,15 @@ def __init__(
else:
self._client_settings = chromadb.config.Settings()
if persist_directory is not None:
self._client_settings = chromadb.config.Settings(
is_persistent=True, persist_directory=persist_directory
)
major, minor, _ = chromadb.__version__.split(".")
if int(major) == 0 and int(minor) < 4:
self._client_settings = chromadb.config.Settings(
chroma_db_impl="duckdb+parquet",
)
else:
self._client_settings = chromadb.config.Settings(is_persistent=True)
self._client_settings.persist_directory = persist_directory

self._client = chromadb.Client(self._client_settings)
self._persist_directory = persist_directory
self._collection = self._client.get_or_create_collection(name=collection_name)

0 comments on commit 6fadde6

Please sign in to comment.