Index and Search Data with Qdrant Embeddings
OpenAI cookbook demo flow for embedding data and indexing/searching it in a local Qdrant instance with payload metadata.
Why it matters
Securely store and search your own data using embeddings with Qdrant, enabling production use cases like chatbots and topic modeling.
Outcomes
What it gets done
Load and embed data using OpenAI embeddings.
Set up and index data into a Qdrant vector database.
Perform semantic searches on indexed titles and content.
Understand the basics of vector database integration for AI applications.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/oai-usingqdrantforembeddingssearch | bash Steps
Steps in the chain
Overview
Using Qdrant for Embeddings Search
OpenAI cookbook demo flow embedding a dataset with OpenAI embeddings and indexing/searching it in a locally Dockerized Qdrant instance, storing id/title/url metadata as payload alongside title and content vectors. Use as a first, minimal introduction to setting up and querying a vector database before building a production chatbot, recommendation, or topic-modelling use case.
What it does
This OpenAI cookbook notebook is a simple end-to-end flow for downloading data, embedding it with OpenAI embeddings, and indexing and searching it in Qdrant - a pattern the guide frames as common for customers who need to store and search embeddings alongside their own data in a secure environment for production use cases like chatbots and topic modelling. It first frames why vector databases matter: embeddings-based use cases (question answering, chatbots, recommendations) often work at small scale, but performance and security concerns block production deployment, and a vector database is the key component for solving that at scale. The demo flow is: set up packages and the embedding model, load and embed a dataset, then set up Qdrant, index the data, and run search queries to confirm it works. For the Qdrant section specifically, it deploys Qdrant locally via Docker - noting that a docker-compose.yaml file is provided in the repo's ./qdrant/ directory and that Docker's memory limit may need to be increased to 8GB or more to avoid the instance being killed - then creates a collection called Articles where each object is described by both a title vector and a content vector using the official qdrant-client package. Alongside the vector configuration, it defines a payload configuration to store additional metadata (here, each article's id, title, and url), which lets search results return not just the nearest title matches but also the article URL pulled straight from that metadata. Searching accepts an optional vector_name parameter to switch between title- and content-based search, using the same text-embedding-ada-002 model that produced the original stored embeddings, since query and stored vectors must match models to be comparable.
When to use - and when NOT to
Use this notebook as a first, minimal introduction to setting up and querying a vector database with OpenAI embeddings before moving to more complex production use cases like chatbots or topic modelling that need secure, scalable embedding storage. It is not a deep dive into Qdrant's advanced features (clustering, cloud deployment, complex filtering) - it deliberately uses the simplest local Docker deployment mode and a bare title/content/payload schema to establish the basic setup-index-search pattern.
Inputs and outputs
Input is a dataset to embed (title and content text) using OpenAI embeddings. Output is a searchable Qdrant Articles collection with title and content vectors plus id/title/url payload metadata, returning nearest-neighbor matches (with their URLs) for a text-embedding-ada-002-encoded query against either vector.
Integrations
Built on Qdrant (deployed locally via Docker/docker-compose.yaml, using the official qdrant-client Python package) and the OpenAI embeddings API (text-embedding-ada-002).
docker-compose up -d
Who it's for
Developers taking their first embeddings use case from small-scale prototype toward a secure, scalable production setup - chatbots, recommendation services, topic modelling - who need a minimal working example of embedding, indexing, and searching data in a vector database.
Source README
Using Qdrant for Embeddings Search
This notebook takes you through a simple flow to download some data, embed it, and then index and search it using a selection of vector databases. This is a common requirement for customers who want to store and search our embeddings with their own data in a secure environment to support production use cases such as chatbots, topic modelling and more.
What is a Vector Database
A vector database is a database made to store, manage and search embedding vectors. The use of embeddings to encode unstructured data (text, audio, video and more) as vectors for consumption by machine-learning models has exploded in recent years, due to the increasing effectiveness of AI in solving use cases involving natural language, image recognition and other unstructured forms of data. Vector databases have emerged as an effective solution for enterprises to deliver and scale these use cases.
Why use a Vector Database
Vector databases enable enterprises to take many of the embeddings use cases we've shared in this repo (question and answering, chatbot and recommendation services, for example), and make use of them in a secure, scalable environment. Many of our customers make embeddings solve their problems at small scale but performance and security hold them back from going into production - we see vector databases as a key component in solving that, and in this guide we'll walk through the basics of embedding text data, storing it in a vector database and using it for semantic search.
Demo Flow
The demo flow is:
- Setup: Import packages and set any required variables
- Load data: Load a dataset and embed it using OpenAI embeddings
- Qdrant
- Setup: Here we'll set up the Python client for Qdrant. For more details go here
- Index Data: We'll create a collection with vectors for titles and content
- Search Data: We'll run a few searches to confirm it works
Once you've run through this notebook you should have a basic understanding of how to setup and use vector databases, and can move on to more complex use cases making use of our embeddings.
Setup
Import the required libraries and set the embedding model that we'd like to use.
Load data
In this section we'll load embedded data that we've prepared previous to this session.
Qdrant
Qdrant. is a high-performant vector search database written in Rust. It offers both on-premise and cloud version, but for the purposes of that example we're going to use the local deployment mode.
Setting everything up will require:
- Spinning up a local instance of Qdrant
- Configuring the collection and storing the data in it
- Trying out with some queries
Setup
For the local deployment, we are going to use Docker, according to the Qdrant documentation: https://qdrant.tech/documentation/quick_start/. Qdrant requires just a single container, but an example of the docker-compose.yaml file is available at ./qdrant/docker-compose.yaml in this repo.
You can start Qdrant instance locally by navigating to this directory and running docker-compose up -d
You might need to increase the memory limit for Docker to 8GB or more. Or Qdrant might fail to execute with an error message like
7 Killed.
Index data
Qdrant stores data in collections where each object is described by at least one vector and may contain an additional metadata called payload. Our collection will be called Articles and each object will be described by both title and content vectors.
We'll be using an official qdrant-client package that has all the utility methods already built-in.
In addition to the vector configuration defined under vector, we can also define the payload configuration. Payload is an optional field that allows you to store additional metadata alongside the vectors. In our case, we'll store the id, title, and url of the articles. As we return the title of nearest articles in the search results from payload, we can also provide the user with the URL to the article (which is part of the meta-data).
Search Data
Once the data is put into Qdrant we will start querying the collection for the closest vectors. We may provide an additional parameter vector_name to switch from title to content based search. Ensure you use the text-embedding-ada-002 model as the original embeddings in file were created with this model.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.