Skip to main content
This guide walks you through creating a complete semantic search pipeline using VectorDB with Chroma as the vector database.

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 file config.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 script index.py to index documents into Chroma:
index.py
Run the indexing script:
You should see output like:
Indexing creates dense vector embeddings for each document using the specified model. These embeddings capture semantic meaning for similarity search.

Step 3: Search your documents

Create a search script search.py to query your indexed documents:
search.py
Run the search script:
You’ll see the top 5 most semantically similar documents to your query.

Step 4: Add RAG answer generation (optional)

To generate answers from retrieved documents, enable RAG in your configuration:
config.yaml
Make sure you have set your GROQ_API_KEY environment variable before enabling RAG.
Update your search script to display the generated answer:
search.py
Now when you run the search, you’ll get an AI-generated answer based on the retrieved documents.

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:
Just update your config file with the appropriate database settings and API keys.

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