VectorStoreIndex over QdrantVectorStore
CompletionImplement a function create_index_from_nodes that builds a VectorStoreIndex over a QdrantVectorStore, following the pattern in build_index_from_nodes from the repository source. Your function must:
- Accept a list of pre-embedded
TextNodeobjects and anembed_model. - Use the centralized Qdrant client (via
_get_qdrant_client()) if the backend is "qdrant"; otherwise fall back to a plain in-memoryVectorStoreIndex. - Create a
QdrantVectorStorewithindex_doc_id=Trueandtext_key="text"so that Qdrant acts as the single source of truth. - Create a
StorageContextfrom the vector store and build theVectorStoreIndexwith it, ensuring LlamaIndex never re-embeds. - Use the provided
collection_namevariable (already computed) for the Qdrant collection.
The starter code has three # TODO: blanks at the critical wiring points. Fill them in.
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