(rewritten by Mason Daugherty (@mdrxy))
aadd_documents() raises TypeError when passing custom document IDs
documents = [
Document(page_content="Hello world"),
Document(page_content="Goodbye world"),
]
ids = ["doc_1", "doc_2"]
# This fails
await vector_store.aadd_documents(documents, ids=ids)
Original:
Checked other resources
Example Code
Extend the example I sent in #32195 but try to add documents to the
await vs.aadd_documents(docs, ids=ids)
This snippet (add documents to a Qdrant Vector Store) will bomb.
Error Message and Stack Trace (if applicable)
aadd_texts() got multiple values for keyword argument 'ids'.
Description
The body of aadd_documents has an if part that is adding ids into kwargs and is also passing it. Python explodes because it is passed explicitly and in kwargs. Here's how I patched it, in the return line:
return await self.aadd_texts(texts, metadatas, **kwargs) # @glebs patch: aadd_texts() got multiple values for keyword argument 'ids'. My patch: simply removed ids=ids from the call expression.
System Info
Same as in #32195
(rewritten by Mason Daugherty (@mdrxy))
aadd_documents()raisesTypeErrorwhen passing custom document IDsOriginal:
Checked other resources
Example Code
Extend the example I sent in #32195 but try to add documents to the
This snippet (add documents to a Qdrant Vector Store) will bomb.
Error Message and Stack Trace (if applicable)
aadd_texts() got multiple values for keyword argument 'ids'.
Description
The body of aadd_documents has an if part that is adding ids into kwargs and is also passing it. Python explodes because it is passed explicitly and in kwargs. Here's how I patched it, in the return line:
System Info
Same as in #32195