mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-07 03:56:39 +00:00
chroma[patch]: Update logic for assigning ids
This commit is contained in:
parent
9c55c75eb5
commit
b909d54e70
@ -433,6 +433,8 @@ class Chroma(VectorStore):
|
||||
# Populate IDs
|
||||
if ids is None:
|
||||
ids = [str(uuid.uuid4()) for _ in uris]
|
||||
else:
|
||||
ids = [id if id is not None else str(uuid.uuid4()) for id in ids]
|
||||
embeddings = None
|
||||
# Set embeddings
|
||||
if self._embedding_function is not None and hasattr(
|
||||
@ -519,10 +521,8 @@ class Chroma(VectorStore):
|
||||
if ids is None:
|
||||
ids = [str(uuid.uuid4()) for _ in texts]
|
||||
else:
|
||||
# Assign strings to any null IDs
|
||||
for idx, _id in enumerate(ids):
|
||||
if _id is None:
|
||||
ids[idx] = str(uuid.uuid4())
|
||||
ids = [id if id is not None else str(uuid.uuid4()) for id in ids]
|
||||
|
||||
embeddings = None
|
||||
texts = list(texts)
|
||||
if self._embedding_function is not None:
|
||||
@ -1169,6 +1169,8 @@ class Chroma(VectorStore):
|
||||
)
|
||||
if ids is None:
|
||||
ids = [str(uuid.uuid4()) for _ in texts]
|
||||
else:
|
||||
ids = [id if id is not None else str(uuid.uuid4()) for id in ids]
|
||||
if hasattr(
|
||||
chroma_collection._client, "get_max_batch_size"
|
||||
) or hasattr( # for Chroma 0.5.1 and above
|
||||
|
Loading…
Reference in New Issue
Block a user