VectorStoreIndex over QdrantVectorStore
FullWrite a Python function create_qdrant_index that wires a VectorStoreIndex over a QdrantVectorStore following the same pattern as build_index_from_nodes in the repository source. The function receives:
client: an already-initializedQdrantClientinstance.collection_name: a string naming the Qdrant collection.nodes: a list ofTextNodeobjects whose.embeddingattribute is already set (pre-embedded).embed_model: an embedding model (e.g.,OpenAIEmbeddinginstance).
Your implementation must:
- Create a
QdrantVectorStorewithindex_doc_id=Trueandtext_key="text"so that Qdrant becomes the single source of truth (node text and metadata live in the point payload). - Build a
StorageContextfrom defaults that uses this vector store. - Build and return a
VectorStoreIndexfrom the pre-embedded nodes using that storage context and the given embed model – LlamaIndex must never re-embed.
Write the function body only (no class or extra code). Assume all necessary imports are already available (e.g., from llama_index.vector_stores.qdrant import QdrantVectorStore, from llama_index.core import StorageContext, VectorStoreIndex).
Your code
Sources
- roadmap-kg/kg/memory_common.py:931-972
- roadmap-kg/kg/memory_common.py:975-990
- roadmap-kg/kg/memory_common.py:836-872