Find answers from the community

Updated 6 months ago

Hi all

At a glance

The community member created a Qdrant vector database locally and tried to load the index from storage, but encountered a ValueError stating that there was no index in the storage context. The comments suggest that the community member does not need to persist or load the index with most vector database integrations, and can instead use VectorStoreIndex.from_vector_store(vector_store) to load the index. The community members note that this information was not clearly documented, and it would be helpful if it was included in the documentation.

Hi all
I created a qdrant vector db locally with this
Plain Text
from qdrant_client import QdrantClient
from llama_index.vector_stores.qdrant import QdrantVectorStore
from llama_index.core import VectorStoreIndex, StorageContext

# For local instance
client = QdrantClient(path="./qdrant_data")

vector_store = QdrantVectorStore(
    "hr", client=client, enable_hybrid=True
)

Settings.chunk_size = 2048
storage_context = StorageContext.from_defaults(vector_store=vector_store)
index = VectorStoreIndex.from_documents(
    documents, storage_context=storage_context
)


then later on i try to do retrieval with
Plain Text
from llama_index.core import VectorStoreIndex, StorageContext
from llama_index.vector_stores.qdrant import QdrantVectorStore
from qdrant_client import QdrantClient
from llama_index.core import load_index_from_storage

# Create a local Qdrant vector store
client = QdrantClient(path="./qdrant_data") 

vector_store = QdrantVectorStore(client=client, collection_name="hr") 

storage_context = StorageContext.from_defaults(vector_store=vector_store)

# Load the persisted index
index = load_index_from_storage(storage_context=storage_context)

but i keep running into
Plain Text
ValueError: No index in storage context, check if you specified the right persist_dir.
L
T
2 comments
you dont need to persist or load with most vector db integrations.

To "load" just do VectorStoreIndex.from_vector_store(vector_store)
Ye found that out a while ago
Not sure if I wasn't looking in the right places, but didn't come across it in the docs (would be nice if it was casually slid in there)
Add a reply
Sign up and join the conversation on Discord