mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-07 12:06:43 +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
|
# Populate IDs
|
||||||
if ids is None:
|
if ids is None:
|
||||||
ids = [str(uuid.uuid4()) for _ in uris]
|
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
|
embeddings = None
|
||||||
# Set embeddings
|
# Set embeddings
|
||||||
if self._embedding_function is not None and hasattr(
|
if self._embedding_function is not None and hasattr(
|
||||||
@ -519,10 +521,8 @@ class Chroma(VectorStore):
|
|||||||
if ids is None:
|
if ids is None:
|
||||||
ids = [str(uuid.uuid4()) for _ in texts]
|
ids = [str(uuid.uuid4()) for _ in texts]
|
||||||
else:
|
else:
|
||||||
# Assign strings to any null IDs
|
ids = [id if id is not None else str(uuid.uuid4()) for id in ids]
|
||||||
for idx, _id in enumerate(ids):
|
|
||||||
if _id is None:
|
|
||||||
ids[idx] = str(uuid.uuid4())
|
|
||||||
embeddings = None
|
embeddings = None
|
||||||
texts = list(texts)
|
texts = list(texts)
|
||||||
if self._embedding_function is not None:
|
if self._embedding_function is not None:
|
||||||
@ -1169,6 +1169,8 @@ class Chroma(VectorStore):
|
|||||||
)
|
)
|
||||||
if ids is None:
|
if ids is None:
|
||||||
ids = [str(uuid.uuid4()) for _ in texts]
|
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(
|
if hasattr(
|
||||||
chroma_collection._client, "get_max_batch_size"
|
chroma_collection._client, "get_max_batch_size"
|
||||||
) or hasattr( # for Chroma 0.5.1 and above
|
) or hasattr( # for Chroma 0.5.1 and above
|
||||||
|
Loading…
Reference in New Issue
Block a user