Developers
ENPT

Inspect conversation context

See the conversation history the avatar actually receives, and how much the summary saves.

In long conversations, the avatar does not reread every message. Tolky keeps a summary of the older part and sends it together with the most recent exchanges. This keeps answers fast and costs low without losing what was said earlier.

This call shows that context for one conversation: the messages and summary the avatar would receive, how many exchanges were kept, and how many characters and tokens the summary saved.

When to use it

  • To check that the avatar still "remembers" something said early in a long conversation.
  • To compare the full history with the optimized one while you tune your avatar.
  • To measure the savings of the summary in your own monitoring.
ReferenceTechnical details

POST /api/externalAPIs/public/smartContext/inspect

Authentication: host token (required). The account always comes from the token; the conversation must belong to it.

ParameterTypeRequiredDescription
conversationIdstring (UUID)YesConversation to inspect.
avatarIdstring (UUID)NoUses the context settings of this avatar.
boxesinteger or nullNoHow many recent customer and avatar exchanges to return. null returns all.
formatstringNoarray (default), json-string or toon (a compact text format).
includeSummarybooleanNoDefault true. With false, returns the recent exchanges without the summary.
forceFullDialoguebooleanNoDefault false. With true, returns the whole history, with no cut and no summary.
waitForSummarybooleanNoDefault true. With false, the call never waits for a new summary: it returns the last one available plus the recent history, and the summary is refreshed in the background.
curl -X POST "https://api.tolky.to/api/externalAPIs/public/smartContext/inspect" \
  -H "Authorization: Bearer $TOLKY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "conversationId": "3f0c2a8e-...", "boxes": 5 }'
{
  "code": 200,
  "message": "OK",
  "data": {
    "data": ["..."],
    "boxCount": 5,
    "totalBoxes": 23,
    "summaryInjected": true,
    "summaryPending": false,
    "pinnedMessageCount": 0,
    "source": "database",
    "cacheHit": false,
    "savings": {
      "originalCharCount": 18200,
      "returnedCharCount": 4100,
      "savedCharCount": 14100,
      "savedPercent": 77.5,
      "estimatedOriginalTokens": 4550,
      "estimatedReturnedTokens": 1025,
      "estimatedSavedTokens": 3525
    },
    "error": null
  }
}
FieldDescription
dataThe context, as an array or a string depending on format.
boxCount, totalBoxesExchanges returned and exchanges in the whole conversation.
summaryInjectedtrue when a summary was included.
summaryPendingtrue when the summary returned is out of date and a refresh was queued.
pinnedMessageCountMessages always kept in the context.
sourceWhere the history came from: globalData, cache, database or rawDialogue.
cacheHittrue when the result came from the cache.
savingsCharacters and estimated tokens before and after optimization.
errorError text, or null.
StatusWhen
400conversationId is missing or format is invalid.
401The token is invalid or does not belong to an account.
403No token was sent.
404The conversation does not exist in your account.
500Internal error.

Previous

Investigate an answer

Next

Follow-up settings