Citations with Sources: Reference Object and RAG
On this page
Updated November 3, 2026 based on Mistral’s Citations & References guide: sources are passed as a tool result in an object where keys are numbers (
"0","1"…) and values containurl,title,snippets(list of lists),description,date, andsource. The “Reference Object” with fieldstype,reference_id, andsource_idfrom the previous version does not appear in the documentation, nor do specific thresholds for the number of sources. Source: Citations & References.
Why citations are essential in production
When you deploy a Retrieval-Augmented Generation (RAG) system in production, your users need to verify the model’s responses. An answer without a source is an unverifiable claim. Citations transform an AI response into a documented, traceable, and reliable one.
Mistral AI natively integrates a citation mechanism that lets the model base its answers on source documents and provide precise references. The model has been deeply trained to ground itself in documents and extract relevant passages.
The reference format
At Mistral, sources do not pass through a dedicated parameter: they reach the model as the result of a tool call. Your tool returns a JSON object where each key is a source number ("0", "1", "2"…) and each value describes the source:
references = {
"0": {
"url": "https://docs.example.com/guide",
"title": "Deployment Guide v3.2",
"snippets": [
[
"Production deployment requires verification...",
"Load tests must validate at least 1000 req/s..."
]
],
"description": None,
"date": "2026-03-15",
"source": "docs-deployment"
}
}
Reference fields
- The key (
"0","1"…) — the source identifier, which the model reuses in its citations url— the address of the original sourcetitle— the source title, for displaysnippets— the relevant excerpts, as a list of lists of sentences: this is the content the model uses to ground its responsedescription— a short description, orNonedate— the publication or update datesource— the origin of the source (a document database, a website)
RAG pipeline architecture with citations
The complete workflow breaks down into four steps.
1. Document search
Your retrieval system (Elasticsearch, Pinecone, pgvector, etc.) returns the documents relevant to the user query.
2. Building references
You structure the retrieved documents in this format:
def build_references(search_results):
"""Converts search results to Mistral's reference format."""
return {
str(i): {
"url": result.get("url", ""),
"title": result["title"],
"snippets": [result["relevant_passages"]],
"description": None,
"date": result.get("date"),
"source": result.get("collection", "default"),
}
for i, result in enumerate(search_results)
}
3. Calling the model with a tool
You declare a tool that the model calls to obtain sources. When called, your code returns json.dumps(references) in a ToolMessage, then you resume the conversation (next lesson).
from mistralai.client import Mistral
client = Mistral(api_key="your-api-key")
get_information_tool = {
"type": "function",
"function": {
"name": "get_information",
"description": "Retrieves relevant document sources",
"parameters": {
"type": "object",
"properties": {"query": {"type": "string"}},
"required": ["query"]
}
}
}
4. The model cites its sources
The final response is not a simple string: its content alternates between TextChunk and ReferenceChunk objects, where the reference_ids field contains the numbers of the cited sources — 0 for key "0". You look these up in your reference table to display titles and links.
Best practices for snippets
Citation quality depends directly on snippet quality, and the first setting to watch is their length. A snippet of two to five sentences gives the model a dense, usable passage; an excerpt spanning a whole page dilutes the relevant information to the point where the model cites the source without truly grounding itself in it. Be careful not to cut too short, though: a snippet ripped from its context can be misinterpreted — “the rate rises to 20%” means nothing if the previous sentence, which specified which rate, was cut off.
The number of sources plays the same role as length, at the query scale: every added source costs context tokens, whether cited or not. Start with a handful of sources and check, in the reference_ids, which ones the model actually uses before adding more. Finally, when timing matters (versioned documentation, pricing, regulations), populate the date field for each source: this is information the model can use, and that you can display.
Key takeaways
- Sources pass through a tool result, indexed by number (
"0","1"…), with URL, title, snippets, and metadata - The Mistral model is natively trained to ground its responses in the provided sources
- Snippets must be concise and contextualized for high-quality citations
- Limit yourself to 3–7 references per query for optimal use
- Citations transform AI responses into verifiable and traceable information