Skip to main content
POST
Classify an assistant reply
Use this endpoint if your app lets users confirm the assistant’s answers. Save a conversation turn only learns facts from what the user says. A fact in the assistant’s reply, such as “Sara manages the website project”, is not remembered as a fact. This endpoint lets it become one, once the user confirms it. How it works:
  1. The user asks a question, and your assistant replies.
  2. You call this endpoint. EDN classifies the reply as one of two kinds:
    • AI_INFERRED: the reply directly answers a factual question the user asked. EDN saves it as an unconfirmed memory, if its facts are backed by the sip you send.
    • AI_GENERATED: anything else, such as a suggestion, a plan or a draft. EDN saves nothing. To keep it for confirmation, save it with Save a generated statement.
  3. Your app shows the saved answer with a confirm option, such as a check mark.
  4. When the user confirms, call Confirm a memory. It becomes a USER_CONFIRMED fact that SIPs use from then on.
If your app has no confirm feature, you can skip this endpoint. Unconfirmed memories are never used until the user confirms them.

What EDN does

  1. Checks whether the reply answers a factual question from the user.
  2. Checks that any figures or named roles in the reply are backed by the sip you send.
  3. Saves the reply as an AI_INFERRED memory when both checks pass.
  4. Otherwise saves nothing, and tells you why in reason.

Required headers

Request

Response

200 OK

Important behavior

  • AI_INFERRED memories are never used in a SIP until the user confirms them with Confirm a memory.
  • reason: not_an_answer means the reply doesn’t answer a factual question from the user, and provenance is AI_GENERATED. To keep it anyway, use Save a generated statement.
  • reason: abstention means the reply says it doesn’t know.
  • reason: unsupported_claim means a figure or named role in the reply isn’t backed by the sip you sent.
  • Each call counts toward your daily limit on saving memory, even when nothing is saved.

Errors

See Error handling.

Authorizations

Authorization
string
header
required

Your EDN API key, sent as Bearer YOUR_API_KEY. Create keys in the Console.

Body

application/json
assistant_message
string
required

How the assistant replied.

Minimum string length: 1
Example:

"Sara manages the website project."

session_id
string
required

Which chat this belongs to.

Required string length: 1 - 128
Example:

"chat-42"

user_message
string
required

What the user said.

Minimum string length: 1
Example:

"Who manages the website project?"

project_id
string | null

Which project/workspace this belongs to. Leave it out for a regular chat.

sip
string | null

The background info/evidence that was given to the assistant when it wrote its answer. EDN uses this to check if any specific facts in the answer are actually backed up. Without it, factual claims can't be verified.

Example:

"[MEMORY CONTEXT]\n- Sara manages the website project. (USER_STATED)\n[END MEMORY CONTEXT]"

Response

Successful Response

provenance
enum<string>
required

How EDN classified the answer. AI_INFERRED: it answers a factual question the user asked. AI_GENERATED: anything else, such as a suggestion or general conversation.

Available options:
AI_INFERRED,
AI_GENERATED
reason
enum<string> | null
required

Why nothing was saved, when saved is false. not_an_answer: the reply doesn't answer a factual question from the user. abstention: the reply says it doesn't know. unsupported_claim: a fact in the reply isn't backed by the sip you sent. Null when saved is true.

Available options:
not_an_answer,
abstention,
unsupported_claim
record_id
string | null
required

The ID of the saved memory when saved is true, otherwise null.

saved
boolean
required

true when EDN saved the answer as an AI_INFERRED memory.