aembed_documents() — langchain Function Reference
Architecture documentation for the aembed_documents() function in embeddings.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 0451d400_70ed_ded5_006c_e334458a80ae["aembed_documents()"] 8ffbd15a_923a_c258_fc8b_25df9b4cba69["MistralAIEmbeddings"] 0451d400_70ed_ded5_006c_e334458a80ae -->|defined in| 8ffbd15a_923a_c258_fc8b_25df9b4cba69 b4b1a205_f414_00ed_dbb1_d40d4e5baef9["aembed_query()"] b4b1a205_f414_00ed_dbb1_d40d4e5baef9 -->|calls| 0451d400_70ed_ded5_006c_e334458a80ae 1ebd0b7d_e260_a53f_7605_d0c94c73ee54["_get_batches()"] 0451d400_70ed_ded5_006c_e334458a80ae -->|calls| 1ebd0b7d_e260_a53f_7605_d0c94c73ee54 style 0451d400_70ed_ded5_006c_e334458a80ae fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/mistralai/langchain_mistralai/embeddings.py lines 272–305
async def aembed_documents(self, texts: list[str]) -> list[list[float]]:
"""Embed a list of document texts.
Args:
texts: The list of texts to embed.
Returns:
List of embeddings, one for each text.
"""
try:
@self._retry
async def _aembed_batch(batch: list[str]) -> Response:
response = await self.async_client.post(
url="/embeddings",
json={
"model": self.model,
"input": batch,
},
)
response.raise_for_status()
return response
batch_responses = await asyncio.gather(
*[_aembed_batch(batch) for batch in self._get_batches(texts)]
)
return [
list(map(float, embedding_obj["embedding"]))
for response in batch_responses
for embedding_obj in response.json()["data"]
]
except Exception:
logger.exception("An error occurred with MistralAI")
raise
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does aembed_documents() do?
aembed_documents() is a function in the langchain codebase, defined in libs/partners/mistralai/langchain_mistralai/embeddings.py.
Where is aembed_documents() defined?
aembed_documents() is defined in libs/partners/mistralai/langchain_mistralai/embeddings.py at line 272.
What does aembed_documents() call?
aembed_documents() calls 1 function(s): _get_batches.
What calls aembed_documents()?
aembed_documents() is called by 1 function(s): aembed_query.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free