Practical overview
When it fits
Use it when you want to study or adapt a small Python example of embedding-based similarity retrieval backed by DuckDB, especially for discussion archives or other text collections.
Who it is for
- Developers exploring semantic search over text collections.
- Python users interested in a DuckDB-backed embedding index and retrieval example.
Documented uses
- Store text and its generated embedding vectors in a DuckDB database.
- Load the example Hacker News comments into an embeddings table.
- Find the 10 comments most similar to a supplied comment.
- Use the repository as a reference for building a related-comment finder or text-document search.
Requirements & limits
The repository is publicly accessible and MIT-licensed. The example requires an OpenAI API key; creating a query embedding when one is not already stored uses OpenAI API usage.
- The documented application is a Python command-line example with DuckDB storage, not a hosted search service.
- OpenAI supplies the embeddings, while DuckDB stores vectors and supports similarity retrieval.
- The README specifies a top-10 result for its Hacker News comment example.
- A query without an existing stored embedding triggers an OpenAI API call.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install and run the Hacker News comment search
Set up the documented Python example, load its comments into DuckDB, and search for similar comments.
Before you start
- Python 3.x
- DuckDB
- OpenAI API key
Steps
Clone the repository and change into its directory.
Install dependencies with pip install -r requirements.txt.
Set the OpenAI API key in environment variables.
Run load_comments.py to populate the embeddings table in hn_embeddings.db, then run main.py with a Hacker News comment.
Expected outcome
The example returns the 10 most similar comments from the stored collection.
Guide limitations
- Generating an embedding for a query that is not already stored calls the OpenAI API and counts against API usage.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 15 October 2026
- Original website title
- patricktrainer/duckdb-embedding-search · Official homepage title · retained in its source language

