aadd_documents() — langchain Function Reference
Architecture documentation for the aadd_documents() function in in_memory.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD b8dd4514_c27c_e70c_d169_5bef6e4d4617["aadd_documents()"] 6e491709_d60f_689d_8a1a_c760b54fd120["InMemoryVectorStore"] b8dd4514_c27c_e70c_d169_5bef6e4d4617 -->|defined in| 6e491709_d60f_689d_8a1a_c760b54fd120 style b8dd4514_c27c_e70c_d169_5bef6e4d4617 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/vectorstores/in_memory.py lines 224–253
async def aadd_documents(
self, documents: list[Document], ids: list[str] | None = None, **kwargs: Any
) -> list[str]:
texts = [doc.page_content for doc in documents]
vectors = await self.embedding.aembed_documents(texts)
if ids and len(ids) != len(texts):
msg = (
f"ids must be the same length as texts. "
f"Got {len(ids)} ids and {len(texts)} texts."
)
raise ValueError(msg)
id_iterator: Iterator[str | None] = (
iter(ids) if ids else iter(doc.id for doc in documents)
)
ids_: list[str] = []
for doc, vector in zip(documents, vectors, strict=False):
doc_id = next(id_iterator)
doc_id_ = doc_id or str(uuid.uuid4())
ids_.append(doc_id_)
self.store[doc_id_] = {
"id": doc_id_,
"vector": vector,
"text": doc.page_content,
"metadata": doc.metadata,
}
return ids_
Domain
Subdomains
Source
Frequently Asked Questions
What does aadd_documents() do?
aadd_documents() is a function in the langchain codebase, defined in libs/core/langchain_core/vectorstores/in_memory.py.
Where is aadd_documents() defined?
aadd_documents() is defined in libs/core/langchain_core/vectorstores/in_memory.py at line 224.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free