mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 06:39:52 +00:00
community[patch]: Chroma use uuid4 instead of uuid1 to generate random ids (#18723)
- **Description:** Chroma use uuid4 instead of uuid1 as random ids. Use uuid1 may leak mac address, changing to uuid4 will not cause other effects. - **Issue:** None - **Dependencies:** None - **Twitter handle:** None
This commit is contained in:
parent
1af2130ff7
commit
9745b5894d
@ -187,7 +187,7 @@ class Chroma(VectorStore):
|
|||||||
b64_texts = [self.encode_image(uri=uri) for uri in uris]
|
b64_texts = [self.encode_image(uri=uri) for uri in uris]
|
||||||
# Populate IDs
|
# Populate IDs
|
||||||
if ids is None:
|
if ids is None:
|
||||||
ids = [str(uuid.uuid1()) for _ in uris]
|
ids = [str(uuid.uuid4()) for _ in uris]
|
||||||
embeddings = None
|
embeddings = None
|
||||||
# Set embeddings
|
# Set embeddings
|
||||||
if self._embedding_function is not None and hasattr(
|
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
|
# TODO: Handle the case where the user doesn't provide ids on the Collection
|
||||||
if ids is None:
|
if ids is None:
|
||||||
ids = [str(uuid.uuid1()) for _ in texts]
|
ids = [str(uuid.uuid4()) for _ in texts]
|
||||||
embeddings = None
|
embeddings = None
|
||||||
texts = list(texts)
|
texts = list(texts)
|
||||||
if self._embedding_function is not None:
|
if self._embedding_function is not None:
|
||||||
@ -721,7 +721,7 @@ class Chroma(VectorStore):
|
|||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
if ids is None:
|
if ids is None:
|
||||||
ids = [str(uuid.uuid1()) for _ in texts]
|
ids = [str(uuid.uuid4()) for _ in texts]
|
||||||
if hasattr(
|
if hasattr(
|
||||||
chroma_collection._client, "max_batch_size"
|
chroma_collection._client, "max_batch_size"
|
||||||
): # for Chroma 0.4.10 and above
|
): # for Chroma 0.4.10 and above
|
||||||
|
Loading…
Reference in New Issue
Block a user