mirror of
https://github.com/langchain-ai/langchain-postgres.git
synced 2026-07-16 01:33:18 -04:00
PGVectorStore faild with AzureAIEmbeddingsModel (Document objects could not be iterable) #93
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pccrdotnet on GitHub (Sep 20, 2025).
Originally assigned to: @averikitsch on GitHub.
At the moment, when I try to create documents using the method store.aadd_documents() with AzureAIEmbeddingsModel as embedding_service it shows an error about an iterable problem (TypeError: 'async_generator' object is not iterable). I think the problem could be when the async method tries to read the metadata object to interact for the insertion operation into the DB, next this is the exception:
File "/home/pablo/projects/RAGPrototype/.venv/lib/python3.10/site-packages/langchain_postgres/v2/vectorstores.py", line 218, in aadd_documents
return await self._engine._run_as_async(
File "/home/pablo/projects/RAGPrototype/.venv/lib/python3.10/site-packages/langchain_postgres/v2/engine.py", line 121, in _run_as_async
return await asyncio.wrap_future(
File "/home/pablo/projects/RAGPrototype/.venv/lib/python3.10/site-packages/langchain_postgres/v2/async_vectorstore.py", line 397, in aadd_documents
ids = await self.aadd_texts(texts, metadatas=metadatas, ids=ids, **kwargs)
File "/home/pablo/projects/RAGPrototype/.venv/lib/python3.10/site-packages/langchain_postgres/v2/async_vectorstore.py", line 377, in aadd_texts
ids = await self.aadd_embeddings(
File "/home/pablo/projects/RAGPrototype/.venv/lib/python3.10/site-packages/langchain_postgres/v2/async_vectorstore.py", line 286, in aadd_embeddings
for id, content, embedding, metadata in zip(ids, texts, embeddings, metadatas):
TypeError: 'async_generator' object is not iterable
Example of the code with the error:
Libraries:
langchain 0.3.27
langchain-azure-ai 0.1.5
langchain-cohere 0.4.6
langchain-community 0.3.27
langchain-core 0.3.76
langchain-experimental 0.3.4
langchain-openai 0.3.33
langchain-postgres 0.0.15
langchain-text-splitters 0.3.9
langgraph 0.6.7
langgraph-checkpoint 2.1.1
langgraph-prebuilt 0.6.4
langgraph-sdk 0.2.6
langsmith 0.4.14
Note: This code works fine when the embedding service changes to DeterministicFakeEmbedding.