When calling the Advanced Search API, you can pass user-specific information through theDocumentation Index
Fetch the complete documentation index at: https://koreai.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
customData.userContext field. This context is available in the Query Rephrase feature, allowing the LLM to tailor how it interprets and rephrases user queries based on who is asking.
userContext is available in the Query Rephrase prompt only. It is not available in the Answer Generation prompt.How It Works
User context can be passed in the API as a customData field. WhenuserContext is included in the API request, Search AI makes it available in the prompt template as the {{customUserContext}} variable The entire object is passed as-is to the LLM, all keys and values in the object are visible to the model, allowing it to reason over them when rephrasing the query.
For example, if you send:
Prerequisites
- Agentic RAG must be enabled in your Search AI application.
- A custom prompt must be configured for the Query Rephrase Agent. Learn more.
Step 1: Pass userContext in the API Request
Include theuserContext object inside customData in your Advanced Search API request:
Step 2: Configure the Query Rephrase Prompt
In the prompt configuration for the Query Rephrase Agent, use{{customUserContext}} to reference the user context and instruct the LLM to apply rephrasing logic based on its contents.
Example prompt configuration:
userContext object and uses the userType field to decide how to rephrase the query. For a user with userType: active, the query “what are my benefits?” might be rephrased to “what benefits and entitlements are available to currently active employees?” before retrieval.
Notes
- The
{{customUserContext}}variable contains the entireuserContextobject as a stringified JSON. All keys in this object are visible to the LLM. userContextis only accessible in the Query Rephrase prompt.- You can include both
userContextandpreviousConversationin the samecustomDataobject — they are independent and do not conflict. - If
userContextis passed but Agentic RAG is disabled, or no custom prompt referencing{{customUserContext}}is configured, the context is ignored.