diff --git a/api/assistant/create-assistant-message.mdx b/api/assistant/create-assistant-message.mdx index 4a59b0fc7..4369fb786 100644 --- a/api/assistant/create-assistant-message.mdx +++ b/api/assistant/create-assistant-message.mdx @@ -33,6 +33,13 @@ function MyComponent({ domain }) { body: { fp: 'anonymous', retrievalPageSize: 5, + context: [ + { + type: 'code', + value: 'const example = "code snippet";', + elementId: 'code-block-1', + }, + ], }, streamProtocol: 'data', sendExtraMessageFields: true, @@ -61,6 +68,12 @@ function MyComponent({ domain }) { - `body.fp` - Fingerprint identifier (use 'anonymous' or a user identifier). - `body.retrievalPageSize` - Number of search results to use (recommended: 5). +**Optional configuration:** +- `body.context` - Array of contextual information to provide to the assistant. Each context object contains: + - `type` - Either `'code'` or `'textSelection'`. + - `value` - The code snippet or selected text content. + - `elementId` (optional) - Identifier for the UI element containing the context. +