What you’ll build
By the end of this quickstart, you’ll have:- A working semantic search pipeline using Chroma
- Documents indexed with dense embeddings
- The ability to search using natural language queries
- Optional RAG answer generation
This example uses Chroma for local development. You can swap to any other supported vector database (Pinecone, Weaviate, Qdrant, Milvus) by changing the configuration.
Before you begin
Make sure you’ve completed the installation steps and have:- Python 3.11+ installed
- VectorDB dependencies installed via
uv sync - Virtual environment activated
Step 1: Create a configuration file
Create a configuration fileconfig.yaml that defines your search pipeline:
config.yaml
This configuration uses the ARC dataset (science reasoning questions) and loads 100 test documents. The embedding model runs on CPU for compatibility.
Step 2: Index your documents
Create a Python scriptindex.py to index documents into Chroma:
index.py
Step 3: Search your documents
Create a search scriptsearch.py to query your indexed documents:
search.py
Step 4: Add RAG answer generation (optional)
To generate answers from retrieved documents, enable RAG in your configuration:config.yaml
search.py
Understanding the pipeline
Here’s what happens under the hood:1
Query embedding
Your query text is converted to a dense vector using the same embedding model used during indexing
2
Similarity search
The vector database finds documents with embeddings closest to your query embedding using cosine similarity
3
Result ranking
Results are ranked by similarity score, with the most relevant documents returned first
4
Optional RAG generation
If enabled, the LLM generates an answer using the retrieved documents as context
Try different vector databases
VectorDB supports multiple vector databases with the same interface. Here’s how to switch from Chroma to Pinecone:Using Haystack instead of LangChain
VectorDB provides identical functionality for both frameworks:Next steps
Now that you have a working semantic search pipeline, explore advanced features:Hybrid search
Combine dense and sparse retrieval for better results
Reranking
Use cross-encoders for higher precision
Query enhancement
Improve recall with multi-query and HyDE
Metadata filtering
Filter results by document attributes