Skip to content

The agent engineering platform.

community[patch]: Chroma use uuid4 instead of uuid1 to generate random ids (#18723)

axiangcoding9745b5894dca
diff --git a/libs/community/langchain_community/vectorstores/chroma.py b/libs/community/langchain_community/vectorstores/chroma.py
index abd64f5627..3bcb389cff 100644
--- a/libs/community/langchain_community/vectorstores/chroma.py
+++ b/libs/community/langchain_community/vectorstores/chroma.py
@@ -187,7 +187,7 @@ class Chroma(VectorStore):
b64_texts = [self.encode_image(uri=uri) for uri in uris]
# Populate IDs
if ids is None:
- ids = [str(uuid.uuid1()) for _ in uris]
+ ids = [str(uuid.uuid4()) for _ in uris]
embeddings = None
# Set embeddings
if self._embedding_function is not None and hasattr(
@@ -268,7 +268,7 @@ class Chroma(VectorStore):
"""
# TODO: Handle the case where the user doesn't provide ids on the Collection
if ids is None:
- ids = [str(uuid.uuid1()) for _ in texts]
+ ids = [str(uuid.uuid4()) for _ in texts]
embeddings = None
texts = list(texts)
if self._embedding_function is not None:
@@ -721,7 +721,7 @@ class Chroma(VectorStore):
**kwargs,
)
if ids is None:
- ids = [str(uuid.uuid1()) for _ in texts]
+ ids = [str(uuid.uuid4()) for _ in texts]
if hasattr(
chroma_collection._client, "max_batch_size"
): # for Chroma 0.4.10 and above