mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-27 00:48:45 +00:00
Gpapp/chromadb (#7891)
- Description: version check to make sure chromadb >=0.4.0 does not throw an error, and uses the default sqlite persistence engine when the directory is set, - Issue: the issue #7887 For attention of - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
parent
41c841ec85
commit
10246375a5
@ -94,10 +94,15 @@ class Chroma(VectorStore):
|
|||||||
if client_settings:
|
if client_settings:
|
||||||
_client_settings = client_settings
|
_client_settings = client_settings
|
||||||
elif persist_directory:
|
elif persist_directory:
|
||||||
_client_settings = chromadb.config.Settings(
|
# Maintain backwards compatibility with chromadb < 0.4.0
|
||||||
chroma_db_impl="duckdb+parquet",
|
major, minor, _ = chromadb.__version__.split(".")
|
||||||
persist_directory=persist_directory,
|
if int(major) == 0 and int(minor) < 4:
|
||||||
)
|
_client_settings = chromadb.config.Settings(
|
||||||
|
chroma_db_impl="duckdb+parquet",
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
_client_settings = chromadb.config.Settings(is_persistent=True)
|
||||||
|
_client_settings.persist_directory = persist_directory
|
||||||
else:
|
else:
|
||||||
_client_settings = chromadb.config.Settings()
|
_client_settings = chromadb.config.Settings()
|
||||||
self._client_settings = _client_settings
|
self._client_settings = _client_settings
|
||||||
@ -459,7 +464,12 @@ class Chroma(VectorStore):
|
|||||||
"You must specify a persist_directory on"
|
"You must specify a persist_directory on"
|
||||||
"creation to persist the collection."
|
"creation to persist the collection."
|
||||||
)
|
)
|
||||||
self._client.persist()
|
import chromadb
|
||||||
|
|
||||||
|
# Maintain backwards compatibility with chromadb < 0.4.0
|
||||||
|
major, minor, _ = chromadb.__version__.split(".")
|
||||||
|
if int(major) == 0 and int(minor) < 4:
|
||||||
|
self._client.persist()
|
||||||
|
|
||||||
def update_document(self, document_id: str, document: Document) -> None:
|
def update_document(self, document_id: str, document: Document) -> None:
|
||||||
"""Update a document in the collection.
|
"""Update a document in the collection.
|
||||||
|
Loading…
Reference in New Issue
Block a user