Comments (1)
The issue you're experiencing with FirestoreKVStore
's aget_all
method is due to not awaiting the doc.get()
coroutine before attempting to call to_dict()
on its result. This leads to the AttributeError: 'coroutine' object has no attribute 'to_dict'
because doc.get()
returns a coroutine that needs to be awaited to obtain the document snapshot, which then allows you to call .to_dict()
on the snapshot.
Here's how you can fix the method:
async def aget_all(self, collection: str = DEFAULT_COLLECTION) -> Dict[str, dict]:
collection_id = self.firestore_collection(collection)
docs = self._adb.collection(collection_id).list_documents()
output = {}
async for doc in docs:
key = doc.id
doc_ref = await doc.get() # Await the coroutine to get the document snapshot
if doc_ref.exists:
data = doc_ref.to_dict() # Now you can safely call to_dict on the document snapshot
if data is None:
continue
val = self.replace_field_name_get(data)
output[key] = val
return output
By awaiting doc.get()
, you ensure that you're working with a document snapshot from which you can safely call .to_dict()
, thus resolving the AttributeError
.
Details
Sources
- llama-index-core/llama_index/core/ingestion/pipeline.py
- llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-firestore/llama_index/storage/kvstore/firestore/base.py
- llama-index-legacy/llama_index/legacy/storage/kvstore/firestore_kvstore.py
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
from llama_index.
Related Issues (20)
- [Bug]: KnowledgeGraphIndex not returning triplets in networkx when using documentation example HOT 4
- [Feature Request]: memary added as a llama Index pack
- [Bug]: custom_llm_provider not honored in litellm.py HOT 5
- [Question]: Multi-agent capability - using agents as tools for other agents HOT 2
- [Bug]: OpenAI max_retries not working HOT 4
- [Bug]: "Event Loop Closed" error in Evaluator calls - only affects MistralAI (llama-index-llms-mistralai) HOT 10
- [Question]: How to specify datatype Float16 of embeddings in Milvus vector store?
- [Bug]: QdrantVectorStore parser always expects a key called "text" in response HOT 1
- [Question]: How does Agentic RAG judge if the question shall be answered via single RAG retrieval or multiple retrievals by agent? HOT 2
- [Question]: Updating metadata and text in existing pinecone index HOT 1
- [Bug]: HOT 2
- [Bug]: Using the command "pip download llama_index==0.10.19" downloaded the wheel file for version "llama_index_core-0.10.40-py3-none-any.whl" instead HOT 2
- [Question]: Can i use multiple collections in mongo at a time? HOT 1
- [Feature Request]: Add structured_output to Gemini
- [Bug]: Graph Index with Azure OpenAI is impossible to query HOT 2
- [Question]: SmartPDFLoader does not work as a file_extractor HOT 5
- [Bug]: llama-index-llms-mlx does not seem to exist HOT 4
- [Bug]: minor doc issue with MLX HOT 1
- [Question]: How to add new SQLTableSchema to an existing ChromaDB embedding? HOT 3
- [Question]: The retriever failed to fetch the relevant info from chromadb HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from llama_index.