Contexte Document
Retrieves the full context of a specific document by its identifier. Returns the text content and associated metadata.
Parameters
| Parameter | Type | Required | Variable | Description |
|---|---|---|---|---|
documentId | dynamic value | Yes | Yes | Identifier of the document to retrieve content from. |
mode | choice (chunks, pages, sections) | No | No | Retrieval mode: by chunks, by pages, or by sections. (Default: "chunks") |
topK | number | No | No | Number of most relevant chunks to return. (Default: 20, min 1, max 100) |
maxTokens | number | No | No | Maximum token budget for the returned content. (Default: 8000, min 100, max 32000) |
query | dynamic value | No | Yes | Optional query to prioritize the most relevant chunks. |
outputVariable | text | No | No | Output variable name containing the document content. |
Parameters marked Variable = Yes accept the
{{blockName.field}}syntax.
Output
Output variable : documentContext
{
"content": "...",
"sourceRefs": [],
"tokenCount": 0,
"truncated": false,
"documentTitle": "...",
"totalChunks": 0,
"returnedChunks": 0
}
Example
Retrieve a document content by ID.
Input :
{"documentId": "doc-42"}
Output :
{"content": "Contenu complet du document...", "metadata": {"title": "Rapport Q1", "pages": 12}}
Tip
Use this block after a search to get the full context of a specific result. {{documentContext.content}} contains the complete text.