When you enable the rich text feature, answers from large language models (LLMs) can include images, tables, and code blocks extracted from your source documents—not just plain text.
How it works
During document indexing, the retrieval-augmented generation (RAG) pipeline extracts all rich text elements (images, tables, and code) from each document and saves them as rich text tags alongside the corresponding text chunk. When a query is submitted via the SearchKnowledge API:
OpenSearch retrieves the relevant chunks, including any embedded rich text tags.
The LLM generates an answer using the retrieved chunks. Rich text tags are preserved in the answer.
Depending on the
rich_text_strategyvalue you set, OpenSearch either renders the tags inline (Markdown) or returns the raw content separately for your app to render.
Enable the rich text feature
Set the rich_text_strategy parameter on the Other Parameters tab of the Q&A Test page. Leave the field blank to disable rich text.

Thedataarray in the response may include items with"type": "IMAGE". These are image results from the retrieval phase—not output from the rich text feature. Rich-text-generated images appear indata.answer(forinside_response) or indata.rich_text_ref(forextend_response), and have better contextual relevance than retrieval-phase images.
Choose a strategy
The rich_text_strategy parameter accepts two values. Choose based on how your app renders content:
| Strategy | Response format | Rich text delivery | Best for |
|---|---|---|---|
inside_response | Markdown | Inline in data.answer | Apps that render Markdown natively |
extend_response | Plain text | Separately in data.rich_text_ref | Apps with custom rendering logic |
Configure the parameter
Add rich_text_strategy to the options.chat object in your SearchKnowledge API request:
{
"question": {
"text": "How do I configure a sensitive data identification rule?",
"type": "TEXT"
},
"options": {
"chat": {
"rich_text_strategy": "inside_response"
}
}
}API parameter reference
The following parameter is added to the SearchKnowledge API operation.
| Parameter | Type | Required | Description |
|---|---|---|---|
options.chat.rich_text_strategy | String | No | The rich text processing strategy. If absent or blank, rich text is disabled and the default processing method is used. Valid values: inside_response, extend_response. |
Parse the response
inside_response
Parse data.answer as Markdown. Rich text tags are resolved inline—tables appear as HTML within the Markdown. Ignore the rich_text_ref field.
extend_response
Parse data.answer as plain text. The answer contains rich text tag placeholders in the format [^<id>^]. Rich text tags in data.rich_text_ref need to be automatically parsed, and logic for replacing the rich text tags in data.answer needs to be developed. Look up each tag ID in data.rich_text_ref and replace the placeholder with the corresponding content.