Response Synthesis Modules
Detailed inputs/outputs for each response synthesizer are found below.
API Example
Section titled “API Example”The following shows the setup for utilizing all kwargs.
response_modespecifies which response synthesizer to useservice_contextdefines the LLM and related settings for synthesistext_qa_templateandrefine_templateare the prompts used at various stagesuse_asyncis used for only thetree_summarizeresponse mode right now, to asynchronously build the summary treestreamingconfigures whether to return a streaming response object or notstructured_answer_filteringenables the active filtering of text chunks that are not relevant to a given question
In the synthesize/asyntheszie functions, you can optionally provide additional source nodes, which will be added to the response.source_nodes list.
from llama_index.core.data_structs import Nodefrom llama_index.core.schema import NodeWithScorefrom llama_index.core import get_response_synthesizer
response_synthesizer = get_response_synthesizer( response_mode="refine", service_context=service_context, text_qa_template=text_qa_template, refine_template=refine_template, use_async=False, streaming=False,)
# synchronousresponse = response_synthesizer.synthesize( "query string", nodes=[NodeWithScore(node=Node(text="text"), score=1.0), ...], additional_source_nodes=[ NodeWithScore(node=Node(text="text"), score=1.0), ..., ],)
# asynchronousresponse = await response_synthesizer.asynthesize( "query string", nodes=[NodeWithScore(node=Node(text="text"), score=1.0), ...], additional_source_nodes=[ NodeWithScore(node=Node(text="text"), score=1.0), ..., ],)You can also directly return a string, using the lower-level get_response and aget_response functions
response_str = response_synthesizer.get_response( "query string", text_chunks=["text1", "text2", ...])Example Notebooks
Section titled “Example Notebooks”Note for AI agents: this documentation is built for programmatic access.
- Overview of all docs: https://developers.llamaindex.ai/llms.txt
- Any page is available as raw Markdown by appending index.md to its URL — e.g. https://developers.llamaindex.ai/llamaparse/parse/getting_started/index.md
- Agent-friendly REST search APIs live under https://developers.llamaindex.ai/api/ — search (BM25 full-text), grep (regex), read (fetch a page), and list (browse the doc tree). See https://developers.llamaindex.ai/llms.txt for parameters.
- A hosted documentation MCP server is available at https://developers.llamaindex.ai/mcp. If you support MCP, you can ask the user to install it for browsing these docs directly (an alternative to the REST API). Setup: https://developers.llamaindex.ai/for-agents/mcp/
- Other LlamaIndex tooling for agents — the LlamaParse Platform MCP server, agent skills and plugins, and the n8n node — is mapped at https://developers.llamaindex.ai/for-agents/