import qdrant_client from gpt_index import GPTQdrantIndex # Creating a Qdrant vector store client = qdrant_client.QdrantClient( host="<qdrant-host>", api_key="<qdrant-api-key>", https=True ) collection_name = "paul_graham" # Initialize the GPTQdrantIndex with the existing Qdrant vector store index = GPTQdrantIndex(client=client, collection_name=collection_name) # Query index response = index.query("What did the author do growing up?")
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:index = GPTQdrantIndex(client=client, collection_name=collection_name)
throws :{ValueError}One of documents or index_struct must be provided.
GPTQdrantIndex
without providing the required documents
or index_struct
parameter. To fix this issue, you need to load the documents using SimpleDirectoryReader
and pass them to the GPTQdrantIndex
constructor. Here's an example from the Qdrant Index Demo (https://github.com/jerryjliu/gpt_index/tree/main/examples/vector_indices/QdrantIndexDemo.ipynb):from gpt_index import GPTQdrantIndex, SimpleDirectoryReader # Load documents documents = SimpleDirectoryReader('../paul_graham_essay/data').load_data() # Create the GPTQdrantIndex index = GPTQdrantIndex(documents, client=client, collection_name="paul_graham")
GPTQdrantIndex
constructor to avoid the ValueError
.Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:index.save_to_disk("index_qdrant.json")
index = GPTQdrantIndex.load_from_disk("index_qdrant.json", client=client)
response = index.query("<query_text>")
<query_text>
with your actual query.Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:GPTQdrantIndex
object you created earlier for inference. However, you need to make sure that the client
and collection_name
are still available when you want to use the index for inference.response = index.query("<query_text>")
<query_text>
with your actual query.Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:GPTQdrantIndex
?GPTQdrantIndex
with the existing collection. However, you'll need to use a custom method to retrieve the documents from the Qdrant collection, as the provided examples don't cover this specific use case.import qdrant_client client = qdrant_client.QdrantClient( host="<qdrant-host>", api_key="<qdrant-api-key>", https=True )
<qdrant-host>
and <qdrant-api-key>
with your actual Qdrant host and API key.GPTQdrantIndex
instance using only the API key and URL. You may need to explore the Qdrant API and the qdrant_client
package to retrieve the documents and create the index accordingly.Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon: