ai-hub
ai-assistants

Retrieve Context from AI Assistant

Retrieves the most relevant context chunks from an AI assistant's knowledge base for a given message.<br/><br/>This endpoint performs a semantic search over the assistant's indexed documents and returns the most relevant text segments (top k chunks). You can specify how many chunks to return and optionally enable re-ranking for more accurate results.<br/><br/>The "use shared history" feature allowing an AI assistant to utilize the agent's conversation history, is only available if used together with Infobip AI agents.

post/ai/1/aiassistants/{assistantId}/retrieve-context

Request

  • Base URL
    https://api.infobip.com (the document declares no server; this is the origin it was published from)
  • Auth
    • OAuth 2
      Client credentials
      Token URL: https://api.infobip.com/auth/1/oauth2/token
    • or API key in header Authorization
    • or API key in header Authorization
    • or HTTP basic

Path parameters

assistantIdstring required

Unique identifier of the AI assistant from which to retrieve context.

Request body

messagestring required

User message to retrieve context for.

kinteger

Number of context chunks to return. Overrides the assistant's default K value. Use this to get more or fewer context chunks.

reRankKinteger

Enables re-ranking for improved precision. When set, retrieves max(k, reRankK) chunks initially, then uses a cross-encoder to return the top K most relevant results.

useSharedHistoryboolean

Flag to indicate whether to use shared conversation history.

sessionIdstring

Session ID to maintain context across multiple queries.

Example request

{
  "message": "How to send SMS?",
  "k": 5,
  "reRankK": 10,
  "sessionId": "session-12345"
}

Response

Context retrieved successfully

Changes

No recorded changes to this operation across all 1 revision of this API.