Finding Relevant Chunks: Semantic Search in RAG Pipelines

April 23, 2026
Anablock
AI Insights & Innovations

Anablock is a technology and AI systems company helping businesses automate workflows, connect tools, improve lead handling, and build smarter digital growth systems. The Anablock team writes about AI implementation, automation, CRM, lead generation, SEO/AEO, and practical ways businesses can use technology to operate better and grow.

Follow Anablock on LinkedIn

Claude MCP Servers

Finding Relevant Chunks: Semantic Search in RAG Pipelines

After breaking a document into chunks, the next step in a RAG pipeline is finding which chunks are most relevant to a user's question. This is essentially a search problem - you need to look through all your text chunks and identify the ones that relate to what the user is asking about.

Semantic Search

The most common approach for finding relevant chunks is semantic search. Unlike keyword-based search that looks for exact word matches, semantic search uses text embeddings to understand the meaning and context of both the user's question and each text chunk.

Text Embeddings

A text embedding is a numerical representation of the meaning contained in some text. Think of it as converting words and sentences into a format that computers can work with mathematically.

Here's how the process works:

  1. You feed text into an embedding model
  2. The model outputs a long list of numbers (the embedding)
  3. Each number ranges from -1 to +1
  4. These numbers represent different qualities or features of the input text

Understanding the Numbers

Each number in an embedding is essentially a "score" for some quality of the input text. However, here's the important caveat: we don't know precisely what each number represents.

While it's helpful to imagine that one number might represent "how happy the text is" or "how much the text talks about oceans," these are just conceptual examples. The actual meaning of each dimension is learned by the model during training and isn't directly interpretable by humans.

VoyageAI for Embeddings

Since Anthropic doesn't currently provide embedding generation, the recommended provider is VoyageAI. You'll need to:

  1. Sign up for a separate VoyageAI account
  2. Get an API key (free to get started)
  3. Add the key to your environment variables

In your .env file, add:

VOYAGE_API_KEY="your_key_here"

Implementation

First, install the VoyageAI library:

%pip install voyageai

Then set up the client and create a function to generate embeddings:

from dotenv import load_dotenv
import voyageai

load_dotenv()
client = voyageai.Client()

def generate_embedding(text, model="voyage-3-large", input_type="query"):
    result = client.embed([text], model=model, input_type=input_type)
    return result.embeddings[0]

When you run this function on a text chunk, you'll get back a list of floating-point numbers representing the embedding. The process is quick and straightforward - the real challenge is understanding how to use these embeddings effectively in your RAG pipeline for finding the most relevant content.

The next step is learning how to compare embeddings to determine which chunks are most similar to a user's question, which forms the core of the semantic search process.


Ready to implement semantic search in your RAG pipeline? Understanding embeddings is the foundation - next, you'll learn how to compare them to find the most relevant chunks for any user query.

Written by

Anablock
Anablock

AI Insights & Innovations

Anablock is a technology and AI systems company helping businesses automate workflows, connect tools, improve lead handling, and build smarter digital growth systems. The Anablock team writes about AI implementation, automation, CRM, lead generation, SEO/AEO, and practical ways businesses can use technology to operate better and grow.

Follow Anablock on LinkedIn

Share this article:
View all articles

Related Articles

The Institutions That Move First Will Win: AI and the Future of Institutional Finance featured image
June 16, 2026
The financial services industry is at an AI inflection point. Institutions that act decisively on AI today will build compounding competitive advantages in deal velocity, research quality, and compliance efficiency. Anablock, an official Anthropic implementation partner, explains why Claude is the right foundation — and how to move fast.

Talk to Anablock about building AI around your workflows.

If you are ready to move from research to implementation, we can help map the right AI system around your tools, data, team, and goals.