Back to Practice

VectorStoreIndex over QdrantVectorStore

Completion
rag

Implement 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 TextNode objects and an embed_model.
  • Use the centralized Qdrant client (via _get_qdrant_client()) if the backend is "qdrant"; otherwise fall back to a plain in-memory VectorStoreIndex.
  • Create a QdrantVectorStore with index_doc_id=True and text_key="text" so that Qdrant acts as the single source of truth.
  • Create a StorageContext from the vector store and build the VectorStoreIndex with it, ensuring LlamaIndex never re-embeds.
  • Use the provided collection_name variable (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