kimaai_chatbot_ungrounded_answer

When it fires

When the groundedness check (Pro) is on and an answer used sources from the knowledge base: a second model call (the utility model of the settings, else the chatbot’s model) compares the answer with the retrieved snippets, and the action fires when it finds the answer goes beyond them or contradicts them. The check runs on kimaai_chatbot_final_message at priority 20, before the answer is saved; after the action the answer gets a note that parts of it could not be verified. Answers without sources are not checked, and a check that fails or gives no verdict does not fire it.

KimaAI hooks it itself: the conversation insights record it, and the human handoff can send the conversation to the team once the answer is saved, when its settings ask for that. The action costs the visitor time, as the answer waits for it: keep the work short.

Parameters

NameTypeDescription
messagestringThe answer text, before the note is added.
reasonstringThe check’s short reason.
payloadarrayThe request as the provider got it, keys in snake_case, with session_id and chatbot_settings.

Example

add_action(
  'kimaai_chatbot_ungrounded_answer',
  function (string $message, string $reason, array $payload): void {
    error_log(sprintf('KimaAI could not verify an answer (session %s): %s', $payload['session_id'] ?? '', $reason));
  },
  10,
  3
);
  • kimaai_chatbot_handoff: fires when the conversation went to the team, also after this check.
  • kimaai_chatbot_guardrails_violation: fires when an answer contains a banned term.
  • kimaai_chatbot_final_message: the answer text the check reads.

What are your feelings