Introduction to Embeddings with the OpenAI API
Create text embeddings with the OpenAI API in Python and use them for semantic search, recommendations, sentiment classification and ChromaDB storage.
Embeddings address a weakness of keyword matching: text that says the same thing in other words gets missed. They turn text into numeric vectors that capture its meaning and intent, so software can measure how close two passages are. You request embeddings through the OpenAI API in Python, compare them with cosine distance, and put them to work on product search, recommendations and the sentiment of reviews. The final part moves the vectors into ChromaDB, where they are stored, queried and filtered on a local system.
What You Will Achieve
- Generate text embeddings with the OpenAI API and inspect the vectors in its response
- Rank products by cosine distance to return the closest match for a search query
- Build a product recommender that takes a user’s viewing history into account
- Keep embedded text in a local ChromaDB collection and retrieve items by meaning and by their metadata
Program Overview
Creating Embeddings and Text Similarity
Starts with what embeddings are and how to request them through the OpenAI API, then compares product descriptions inside the vector space.
- Embeddings models and their applications
- The embeddings API response
- Visualizing embedded product descriptions with t-SNE
- Cosine distance and more repeatable results
Semantic Search, Recommendations, and Classification
Applies embeddings to product and review data, enriching the inputs so each vector carries more of an item’s detail.
- Enriched embeddings and sorting by similarity
- Semantic search for an online retail catalog
- Recommendation systems with user history
- Sentiment classification of restaurant reviews
Vector Databases with ChromaDB
Shows why production embedding systems keep vectors in a dedicated database, then builds and maintains collections in ChromaDB.
- Choosing a vector database and deciding on metadata
- Estimating embedding costs with tiktoken
- Adding, updating and deleting collection items
- Querying with multiple texts and filtering
Certificate Awarded (Paid)
Job Outlook
Embedding skills are used in AI application development, where teams add semantic search, product recommendations and text classification to software built on language model APIs and vector databases.
Good for: Python developers and data practitioners who want to build semantic search, recommendation or classification features on top of OpenAI embeddings.
Keep in mind: The exercises are built around OpenAI’s embeddings models and ChromaDB, so using another model provider or vector database means adapting the code on your own.
Bottom line: A tight run through three practical uses of embeddings, closing with ChromaDB collections that you query, update and filter by metadata.
Frequently Asked Questions
Which Python libraries are used alongside the OpenAI API?
Besides the OpenAI embeddings endpoint, the exercises use scikit-learn to visualize embeddings with t-SNE, SciPy to compute cosine similarity, tiktoken to estimate costs, and ChromaDB as the vector database.
What data are the exercises built on?
The search and recommendation lessons embed product descriptions for an online retail platform, the classification lessons embed restaurant reviews to judge their sentiment, and the vector database lessons query a Netflix collection.
Why does the course end with a vector database?
Applications that rely on embeddings in production usually store and query them in a vector database, which is more efficient and reproducible. The final chapter builds ChromaDB collections, adds metadata, and runs filtered and multi-text queries.
How does the course handle the cost of creating embeddings?
One lesson in the vector database chapter estimates embedding costs with tiktoken before the data is added to a ChromaDB collection, so the size of a job can be judged before it runs.


There are no reviews yet.