-
I can successfully create indexes in Qdrant with LlamaIndex. However, when I try to query these indexes I run into problems. Here is my code: ` client = qdrant_client.QdrantClient(url='http://localhost:6333', prefer_grpc=True) llm = ChatOpenAI(model_name=gpt3_5_turbo_model_name, index = VectorStoreIndex.from_vector_store(vector_store=vector_store) ` The code fails trying to retrieve the index from Qdrant vector store. AttributeError: 'Qdrant' object has no attribute 'stores_text' The only similar issue in the forum was here (#6686) but it appears to be different and based on not already successfully creating the index in the vector store. Any idea? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
🤖 Hello, The error you're encountering is likely due to trying to access the 'stores_text' attribute from a 'Qdrant' object, while this attribute is actually defined in the 'QdrantVectorStore' class. In your code, you're creating an instance of 'QdrantVectorStore' and passing it to the 'from_vector_store' method of 'VectorStoreIndex'. However, the error message suggests that the 'from_vector_store' method is trying to access the 'stores_text' attribute from a 'Qdrant' object, not from a 'QdrantVectorStore' object. Here's the correct flow: from llama_index import SimpleDirectoryReader
from llama_index import VectorStoreIndex
documents = SimpleDirectoryReader('test_library', recursive=True).load_data()
# initial creation of index
index = VectorStoreIndex.from_documents(documents)
# after creation, you can connect/reinitialize like so
loaded_index = VectorStoreIndex.from_vector_store(index.vector_store) For persisting the index, you can use the # Persist the index
index.storage_context.persist('saved_index.json') This will save the index to a JSON file named 'saved_index.json'. If you want to save it to a different directory, you can provide the directory path as the argument to the Please ensure that you're accessing the 'stores_text' attribute from an instance of the 'QdrantVectorStore' class, not from a 'Qdrant' object. Let me know if this helps or if you have any other questions. Best, Sources
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. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
🤖
Hello,
The error you're encountering is likely due to trying to access the 'stores_text' attribute from a 'Qdrant' object, while this attribute is actually defined in the 'QdrantVectorStore' class.
In your code, you're creating an instance of 'QdrantVectorStore' and passing it to the 'from_vector_store' method of 'VectorStoreIndex'. However, the error message suggests that the 'from_vector_store' method is trying to access the 'stores_text' attribute from a 'Qdrant' object, not from a 'QdrantVectorStore' object.
Here's the correct flow: