mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-25 04:49:17 +00:00
chroma[patch]: fix bug (#28538)
Fix bug introduced in https://github.com/langchain-ai/langchain/pull/27995 If all document IDs are `""`, the chroma SDK will raise ``` DuplicateIDError: Expected IDs to be unique ``` Caught by [docs tests](https://github.com/langchain-ai/langchain/actions/runs/12180395579/job/33974633950), but added a test to langchain-chroma as well.
This commit is contained in:
@@ -1228,7 +1228,7 @@ class Chroma(VectorStore):
|
||||
texts = [doc.page_content for doc in documents]
|
||||
metadatas = [doc.metadata for doc in documents]
|
||||
if ids is None:
|
||||
ids = [doc.id if doc.id else "" for doc in documents]
|
||||
ids = [doc.id if doc.id else str(uuid.uuid4()) for doc in documents]
|
||||
return cls.from_texts(
|
||||
texts=texts,
|
||||
embedding=embedding,
|
||||
|
Reference in New Issue
Block a user