---
title: "Claude Embeddings and RAG Pipelines: A Practical Guide"
canonical_url: "https://www.calypso.so/blog/claude-embeddings-rag-pipelines"
last_updated: "2026-08-05T17:32:23.931Z"
meta:
  description: "Build Claude retrieval systems with text and multimodal embeddings, reranking, and citations for grounded answers from messy documents."
  keywords: "Claude embeddings, RAG pipeline, multimodal retrieval, Voyage AI"
  "og:description": "Build Claude retrieval systems with text and multimodal embeddings, reranking, and citations for grounded answers from messy documents."
  "og:title": "Claude Embeddings and RAG Pipelines: A Practical Guide"
  "twitter:description": "Build Claude retrieval systems with text and multimodal embeddings, reranking, and citations for grounded answers from messy documents."
  "twitter:title": "Claude Embeddings and RAG Pipelines: A Practical Guide"
---

Calypso home

Blog / rag-engineering

# **Building Embeddings and RAG Pipelines with Claude**

A practical guide to building Claude retrieval systems with text and multimodal embeddings, reranking, and citations.

**Claude****embeddings****RAG****multimodal retrieval****Voyage**

![Calypso Research](https://www.calypso.so/logo-calypso-icon.png)

**Calypso Research**

8 min read·June 25, 2026·12 sources

**Essay ** To build retrieval-augmented generation (RAG) with Claude, treat Claude as the reasoning and answer-generation layer—not as the search index. Anthropic does not currently offer its own embedding model, so a production Claude RAG system still needs a retrieval stack that ingests source content, creates embeddings, stores and searches vectors, reranks candidates, and sends the strongest evidence to Claude. Anthropic's documentation points developers to Voyage AI for embeddings and reranking, while Claude handles grounded synthesis, citations, tool use, and structured output. ## Does Claude have an embedding model? No. Anthropic's current embeddings documentation states that Anthropic does not provide a native embedding model. Claude can reason over text, images, and documents placed in its context, but that is different from creating a persistent search index over a large knowledge base. This distinction matters in production. Sending a PDF directly to Claude is useful for one-off document analysis. Building a support assistant, internal knowledge agent, or product search experience requires a durable retrieval layer that can index thousands or millions of passages and recover the right evidence for each question. ## How a Claude RAG pipeline works The most important architectural rule is to separate retrieval from generation. Retrieval decides what Claude is allowed to see. Claude then interprets that evidence, resolves ambiguity, follows the requested format, and writes the final answer. When a Claude answer is weak, the model is not always the problem. The retriever may have missed the right passage, returned stale content, mixed permissions, or supplied chunks that were too fragmented to support a complete answer. - Ingest files, web pages, databases, or application records. - Parse the content while preserving page, section, table, image, and permission metadata. - Split the source into retrieval units that are meaningful on their own. - Create document embeddings and store them in a vector-capable search index. - Embed the user's query with the matching query configuration. - Retrieve a broad candidate set with vector, lexical, or hybrid search. - Apply metadata filters and rerank the candidates for query-specific relevance. - Send only the strongest evidence to Claude for synthesis and citation. - Evaluate retrieval quality and answer quality separately. ## Choose the right Voyage AI embedding model for Claude RAG For general-purpose text retrieval, Voyage's current generation includes `voyage-4-large`, `voyage-4`, and `voyage-4-lite`. Use `voyage-4-large` when retrieval quality is the priority, `voyage-4` when you want a balance of quality and efficiency, and `voyage-4-lite` when latency and cost matter most. The Voyage 4 text models support a 32,000-token context window and configurable embedding dimensions. Voyage also provides domain-oriented models. `voyage-code-3` is designed for code retrieval, `voyage-finance-2` for financial search and RAG, and `voyage-law-2` for legal retrieval. A specialized model can help when the corpus uses domain-specific language that a general-purpose retriever may not rank reliably. For retrieval, set the embedding `input_type` correctly: index source content as `document` and embed user searches as `query`. Voyage applies different retrieval-oriented prompting for those two roles while keeping the resulting vectors compatible. The Python example below shows the retrieval-specific distinction in practice: source chunks are embedded with `input_type="document"`, while the user's search is embedded with `input_type="query"`. The returned document vectors belong in your vector-capable database; the query vector is used to retrieve nearby candidates.**python**Example snippet 1```
import voyageai
``` 2```
``` 3```
# Reads VOYAGE_API_KEY from the environment.
``` 4```
voyage = voyageai.Client()
``` 5```
``` 6```
documents = [
``` 7```
    "Enterprise accounts can require SSO during onboarding.",
``` 8```
    "Workspace administrators can invite members by email.",
``` 9```
    "API keys are created from the developer settings page.",
``` 10```
]
``` 11```
``` 12```
# Index source chunks as documents.
``` 13```
document_vectors = voyage.embed(
``` 14```
    documents,
``` 15```
    model="voyage-4",
``` 16```
    input_type="document",
``` 17```
).embeddings
``` 18```
``` 19```
query = "How do enterprise customers configure onboarding security?"
``` 20```
``` 21```
# Embed searches as queries with the same model family.
``` 22```
query_vector = voyage.embed(
``` 23```
    [query],
``` 24```
    model="voyage-4",
``` 25```
    input_type="query",
``` 26```
).embeddings[0]
``` 27```
``` 28```
# Store document_vectors in your vector-capable database.
``` 29```
# At query time, use query_vector to retrieve the nearest chunks.
```## Use multimodal embeddings when meaning lives in the page Text embeddings work well for clean prose, API documentation, policies, help-center articles, and other sources whose meaning survives text extraction. They are less reliable when the answer depends on layout, a chart axis, a screenshot, a table structure, a diagram, or the relationship between text and an image. For those sources, `voyage-multimodal-3.5` can place interleaved text and visual content in a shared embedding space. It is designed for content-rich images such as PDF screenshots, slides, tables, figures, photos, and video frames. This avoids reducing every document to OCR text before retrieval. Claude can also analyze text, pictures, charts, and tables in PDFs supplied to the model. That makes it a strong answer layer after retrieval, but you still need an indexing strategy when the document collection is too large to place in a single request. ## Chunk documents by meaning, not by an arbitrary token count Fixed-size chunking is easy to implement, but it often separates a claim from its heading, definition, table, exception, or footnote. Better chunks follow the document's structure: sections for prose, endpoint-level units for API documentation, rows plus headers for tables, and page regions for visually rich files. Each chunk should carry enough metadata to be useful after retrieval: document ID, title, canonical URL, page number, section path, timestamps, tenant or permission scope, and a stable source locator for citations. Contextualized chunk embeddings are another option when isolated chunks lose too much document-level meaning. Voyage's contextualized embedding models encode a chunk with awareness of surrounding document context, which can improve retrieval for passages containing pronouns, shorthand, or section-specific terminology. ## Combine semantic retrieval, lexical search, and metadata filters Vector search is good at semantic similarity, but exact terms still matter. Product names, error codes, legal citations, SKUs, version numbers, and people's names are often handled better by lexical methods such as BM25. A hybrid retriever can combine both signals before reranking. Metadata filtering should happen before or during retrieval, not after Claude has seen the content. Filter by tenant, user permissions, product, language, geography, content status, and effective date. This improves relevance and prevents content from crossing security boundaries. Retrieve broadly enough to protect recall, but do not send the entire candidate set to Claude. The retrieval stage should produce possibilities; the reranker should decide which passages deserve prompt space. ## Why reranking improves Claude RAG answers Embedding search compares independently created query and document vectors. That makes it fast enough to search a large corpus, but the top results can still be merely related to the question rather than directly useful. A reranker evaluates the query and each candidate document together. Voyage describes its rerankers as cross-encoders, which can make a more precise relevance judgment than vector similarity alone. Current recommended options include `rerank-2.5` and `rerank-2.5-lite`. A common pattern is to retrieve a few dozen candidates, rerank them, remove duplicates or overlapping passages, and send a smaller evidence set to Claude. This generally produces cleaner prompts, lower generation cost, and answers that stay closer to the source. The example below assumes a first-stage retriever has already produced several candidate passages. Voyage then scores those candidates against the full query and returns a smaller ordered set that can be passed to Claude.**python**Example snippet 1```
import voyageai
``` 2```
``` 3```
voyage = voyageai.Client()
``` 4```
``` 5```
query = "How do enterprise customers configure onboarding security?"
``` 6```
``` 7```
# These would normally come from vector, lexical, or hybrid search.
``` 8```
candidates = [
``` 9```
    "Enterprise accounts can require SSO during onboarding.",
``` 10```
    "Workspace administrators can invite members by email.",
``` 11```
    "The billing page contains downloadable monthly invoices.",
``` 12```
    "SAML configuration is available on the Enterprise plan.",
``` 13```
]
``` 14```
``` 15```
reranked = voyage.rerank(
``` 16```
    query=query,
``` 17```
    documents=candidates,
``` 18```
    model="rerank-2.5",
``` 19```
    top_k=3,
``` 20```
)
``` 21```
``` 22```
retrieved_chunks = [
``` 23```
    {
``` 24```
        "text": result.document,
``` 25```
        "score": result.relevance_score,
``` 26```
        "original_index": result.index,
``` 27```
    }
``` 28```
    for result in reranked.results
``` 29```
]
``` 30```
``` 31```
for chunk in retrieved_chunks:
``` 32```
    print(chunk)
```## Ground Claude's final answer with source-level citations A fluent answer is not automatically a trustworthy answer. Claude's citations feature can attach references to the source passages used in a response, allowing a user to inspect the evidence instead of accepting the answer on presentation alone. Citation quality starts during ingestion. Preserve source boundaries and stable locators so a retrieved passage can point back to the correct file, page, section, or URL. When RAG chunks are passed to Claude as distinct source documents, the system can return more granular references. The application should also define what happens when the evidence is weak. A production assistant should be able to say that the sources do not contain enough information rather than filling the gap with an unsupported answer. The example below turns each retrieved chunk into a citable Claude document block. In production, preserve the canonical URL, file ID, page, section, and access scope alongside each chunk so the interface can render a useful source reference.**python**Example snippet 1```
import anthropic
``` 2```
``` 3```
# Reads ANTHROPIC_API_KEY from the environment.
``` 4```
client = anthropic.Anthropic()
``` 5```
``` 6```
query = "How do enterprise customers configure onboarding security?"
``` 7```
``` 8```
# Replace these examples with the chunks returned by your retriever.
``` 9```
retrieved_chunks = [
``` 10```
    {
``` 11```
        "title": "Enterprise onboarding guide",
``` 12```
        "text": "Enterprise accounts can require SSO during onboarding.",
``` 13```
        "url": "https://docs.example.com/enterprise-onboarding",
``` 14```
    },
``` 15```
    {
``` 16```
        "title": "SAML configuration",
``` 17```
        "text": "SAML configuration is available on the Enterprise plan.",
``` 18```
        "url": "https://docs.example.com/saml",
``` 19```
    },
``` 20```
]
``` 21```
``` 22```
documents = [
``` 23```
    {
``` 24```
        "type": "document",
``` 25```
        "source": {
``` 26```
            "type": "text",
``` 27```
            "media_type": "text/plain",
``` 28```
            "data": chunk["text"],
``` 29```
        },
``` 30```
        "title": chunk["title"],
``` 31```
        "context": f"Canonical source: {chunk['url']}",
``` 32```
        "citations": {"enabled": True},
``` 33```
    }
``` 34```
    for chunk in retrieved_chunks
``` 35```
]
``` 36```
``` 37```
response = client.messages.create(
``` 38```
    model="claude-sonnet-4-6",
``` 39```
    max_tokens=1200,
``` 40```
    messages=[
``` 41```
        {
``` 42```
            "role": "user",
``` 43```
            "content": [
``` 44```
                *documents,
``` 45```
                {
``` 46```
                    "type": "text",
``` 47```
                    "text": (
``` 48```
                        f"Answer this question using only the supplied sources: {query} "
``` 49```
                        "If the evidence is insufficient, say so."
``` 50```
                    ),
``` 51```
                },
``` 52```
            ],
``` 53```
        }
``` 54```
    ],
``` 55```
)
``` 56```
``` 57```
for block in response.content:
``` 58```
    if block.type != "text":
``` 59```
        continue
``` 60```
``` 61```
    print(block.text)
``` 62```
    for citation in getattr(block, "citations", []) or []:
``` 63```
        print(
``` 64```
            "Citation:",
``` 65```
            citation.document_title,
``` 66```
            getattr(citation, "cited_text", ""),
``` 67```
        )
```## Return structured output when the answer feeds another system Human-readable prose is appropriate for chat, but many Claude RAG workflows end in a product UI, API response, automation, or another agent. Claude's structured outputs can constrain a response to a JSON schema, producing validated fields for the answer, citations, confidence state, extracted entities, recommended actions, or follow-up questions. Keep the retrieved evidence separate from the generated fields in your application model. That separation makes the result easier to debug, cache, evaluate, and replay when retrieval or generation settings change. Claude citations and Structured Outputs are currently incompatible in the same API request. Enabling citations on supplied documents while also setting `output_config.format` returns an error. Choose a citation-rich natural-language response or a schema-constrained JSON response for that call, or separate citation generation and downstream structuring into two explicit stages. ## Evaluate retrieval and generation as separate systems End-to-end answer accuracy does not tell you where a Claude RAG pipeline failed. Build a test set with real questions, expected source passages, acceptable answers, and cases where the system should abstain. Measure retrieval with metrics such as recall at k, precision at k, mean reciprocal rank, or normalized discounted cumulative gain. Measure the final response for answer correctness, faithfulness to the retrieved evidence, citation support, completeness, latency, and abstention behavior. Run evaluations whenever you change the embedding model, chunking rules, metadata filters, candidate count, reranker, prompt, or Claude model. RAG quality is a property of the whole pipeline, not one model in isolation. ## Production considerations: latency, cost, freshness, and security Embedding is usually an ingestion-time cost, while query embedding, search, reranking, and Claude generation happen on the request path. Cache stable query results where appropriate, batch offline indexing, and avoid re-embedding unchanged content. Multimodal ingestion may be priced using both text tokens and image pixels, and reranking cost grows with the query and candidate documents processed. Use smaller models or fewer candidates only after evaluation shows that the quality tradeoff is acceptable. Freshness and deletion are part of retrieval correctness. Track source versions, remove deleted content from the index, re-embed changed sections, and ensure permission changes are reflected before the next search. ## Build a Claude RAG knowledge layer with Calypso Calypso is designed for teams that want grounded, multimodal answers without assembling every ingestion, retrieval, citation, and delivery component from scratch. Buckets organize the source layer, Agents define retrieval behavior and answer policy, and Integrations deliver the same grounded knowledge through websites, APIs, workflows, MCP clients, and product interfaces. Claude remains the reasoning engine. Calypso provides the reusable knowledge layer around it, so teams can focus on the experience they are shipping instead of rebuilding the same RAG plumbing for every interface. ## Claude embeddings and RAG: frequently asked questions - Does Claude create embeddings? No. Anthropic currently directs developers to external embedding providers such as Voyage AI. - Can Claude read PDFs without RAG? Yes, Claude can analyze supplied PDFs, including text and visual content, but direct PDF analysis is not a persistent search index. - Do I need a vector database for Claude? Not for every small prototype, but a scalable knowledge base normally needs a vector-capable or hybrid search system. - Should I rerank retrieved passages? Reranking is especially useful when the corpus is large, the query is ambiguous, or first-pass retrieval returns many semantically adjacent results. - Can Claude return citations? Yes. Claude supports source citations for grounded document answers when citations are enabled and the source content is supplied in a supported form. - Can Claude RAG return JSON? Yes. Structured outputs can constrain the final response to a validated JSON schema for downstream applications.**Sources ** References and source material used in this essay. - [**1****Anthropic: Embeddings**platform.claude.com](https://platform.claude.com/docs/en/build-with-claude/embeddings) - [**2****Anthropic: Retrieval-augmented generation guide**platform.claude.com](https://platform.claude.com/cookbook/capabilities-retrieval-augmented-generation-guide) - [**3****Anthropic: PDF support**platform.claude.com](https://platform.claude.com/docs/en/build-with-claude/pdf-support) - [**4****Anthropic: Citations**platform.claude.com](https://platform.claude.com/docs/en/build-with-claude/citations) - [**5****Anthropic: Search results and RAG citations**platform.claude.com](https://platform.claude.com/docs/en/build-with-claude/search-results) - [**6****Anthropic: Structured outputs**platform.claude.com](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) - [**7****Voyage AI: Text embeddings**docs.voyageai.com](https://docs.voyageai.com/docs/embeddings) - [**8****Voyage AI: Multimodal embeddings**docs.voyageai.com](https://docs.voyageai.com/docs/multimodal-embeddings) - [**9****Voyage AI: Contextualized chunk embeddings**docs.voyageai.com](https://docs.voyageai.com/docs/contextualized-chunk-embeddings) - [**10****Voyage AI: Rerankers**docs.voyageai.com](https://docs.voyageai.com/docs/reranker) - [**11****Voyage AI: Pricing**docs.voyageai.com](https://docs.voyageai.com/docs/pricing) - [**12****Anthropic: Claude models overview**platform.claude.com](https://platform.claude.com/docs/en/about-claude/models/overview)**Keep reading **## Related essays. More writing from the same engineering and product topic cluster. [Technical Guiderag-engineering**Jul 2, 2026 · 12 min read**<h3>**Building a Low-Latency RAG Pipeline with Groq: From Ingestion to Grounded Answers**</h3>A practical guide to building a fast, citation-backed RAG pipeline with Groq, from ingestion and retrieval to grounded answers.**Groq****RAG**rag-engineering**Read article **](https://www.calypso.so/blog/low-latency-rag-with-groq) [Technical Guiderag-engineering**Jun 25, 2026 · 5 min read**<h3>**LlamaIndex and RAG Workflows: How Production Retrieval Apps Are Built**</h3>A technical deep dive into how LlamaIndex structures ingestion, indexing, retrieval, synthesis, and event-driven RAG workflows.**LlamaIndex****RAG**rag-engineering**Read article **](https://www.calypso.so/blog/llamaindex-rag-workflows) [Technical Guiderag-engineering**Jun 25, 2026 · 4 min read**<h3>**ChatGPT, Embeddings, and RAG Pipelines: How Grounded AI Answers Actually Work**</h3>A technical guide to how ChatGPT, embeddings, vector search, and RAG pipelines work together to produce grounded AI answers.**ChatGPT****embeddings**rag-engineering**Read article **](https://www.calypso.so/blog/chatgpt-embeddings-rag-pipelines)**From essay to product**## **Turn engineering ideas into source-backed answers.** Use Calypso to organize sources, attach them to hosted agents, and launch grounded answers across your website, workflows, and product UI. [**See live demo **](https://www.calypso.so/demos) [**Get Started for Free **](https://rag.calypso.so/join)