Quick overview
- Start a Qdrant instance locally (Docker).
- Connect from a Jupyter Notebook using
qdrant-client. - Create a collection, upsert sample points (vectors + payload), and run simple retrieval/inspection APIs.
Prerequisites
Connect from a Jupyter Notebook
The simplest import and connection looks like this:http://localhost:6333) or uses a QDRANT_URL environment variable if provided.
Requirements (notebook / container)
Add at minimum the following to yourrequirements.txt:
Container image (Dockerfile)
This demo uses a Docker image that pulls the official Qdrant image and prepares a workspace with Python and Jupyter. Use this concise Dockerfile:Build and run (local)
Build and run the container locally:6333 by default; 6334 is for gRPC. Jupyter (if used) typically runs on port 8888.
You can manage Qdrant via its dashboard (HTTP) or entirely through the Python client — the UI is mostly for administrative convenience.
Verify connection from the notebook
After starting Qdrant, run the connection cell in your notebook. Example (same as above to verify connectivity):List collections (showing collections like tables in an RDBMS)
Programmatically list collections to confirm connectivity and inspect existing collections:Open the Qdrant dashboard from the notebook (optional)
Display a link to the dashboard inside a Jupyter environment:Create or recreate a collection
Define a collection to store vectors and recreate it (note: this deletes an existing collection with the same name before creating a new one). UseVectorParams to set the vector dimensionality and distance metric:
recreate_collection will delete an existing collection with the same name. Use with caution in production environments to avoid accidental data loss.Insert points (vectors + payload)
Insert a few sample vectors (called points) along with payload metadata:Inspect stored points
For small datasets, the scroll API is a convenient way to retrieve stored points:What is a vector?
A vector is a list of numeric values (floats) representing an embedding for a piece of data (text, image, etc.). The vector dimensionality must match thesize specified in VectorParams. Vector similarity search (nearest-neighbor search) is based on distance metrics such as cosine or euclidean.
Next steps / Common workflows
Once embeddings are stored in the vector database, typical next steps include:- Running nearest-neighbor similarity searches with
client.searchorclient.search_with_payload. - Integrating into a RAG pipeline: store document embeddings and retrieve relevant passages at query time.
- Combining metadata filtering with vector search for more precise retrieval.
- Packaging the notebook or application as a Docker image and deploying to Kubernetes for production.
- Qdrant (this lesson)
- ChromaDB
- LanceDB
- Pinecone
- Weaviate
References and further reading
- Qdrant: https://qdrant.tech/
- qdrant-client (Python): https://github.com/qdrant/qdrant-client
- Jupyter: https://jupyter.org/
- Docker: https://www.docker.com/
- Kubernetes basics: https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/