langchain-ai/langchain

`aadd_texts() got multiple values for keyword argument 'ids'`

Open

#32.283 aperta il 28 lug 2025

Vedi su GitHub
 (6 commenti) (0 reazioni) (1 assegnatario)Python (22.617 fork)batch import
bugexternalhelp wantedqdrant

Metriche repository

Star
 (136.758 star)
Metriche merge PR
 (Merge medio 10g 2h) (288 PR mergiate in 30 g)

Descrizione

(rewritten by @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

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

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

Guida contributor