Skip to main content

Contexte Document

Retrieves the full context of a specific document by its identifier. Returns the text content and associated metadata.

Parameters

ParameterTypeRequiredVariableDescription
documentIddynamic valueYesYesIdentifier of the document to retrieve content from.
modechoice (chunks, pages, sections)NoNoRetrieval mode: by chunks, by pages, or by sections. (Default: "chunks")
topKnumberNoNoNumber of most relevant chunks to return. (Default: 20, min 1, max 100)
maxTokensnumberNoNoMaximum token budget for the returned content. (Default: 8000, min 100, max 32000)
querydynamic valueNoYesOptional query to prioritize the most relevant chunks.
outputVariabletextNoNoOutput 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.