Evaluation API

API to evaluate a conversation transcript based on user defined attributes (e.g. clarity of responses, courtesy, listening skills, and more).

Convai's Evaluation API endpoint

POST https://api.convai.com/character/evaluate_conversation

This API allows you to evaluate a conversation transcript based on user defined attributes e.g. clarity of responses, courtesy, listening skills, and more. The evaluation will be returned in a structured JSON format.

Headers

Name
Type
Description

CONVAI-API-KEY*

String

The unique api-key provided for every account.

Request Body

Name
Type
Description

session_id

String (required)

The ID of the session you want to evaluate.

character_id

String (required)

The ID of the character performing the evaluation.

prompt

String (required)

A predefined or custom prompt containing the transcript and specific instructions for evaluation.

variables

JSON Object (optional)

A set of key-value pairs providing additional data required for evaluation (e.g., customer name, item details). This depends on the prompt being passed.

Example Payload

{
  "session_id": "<SESSION ID>",
  "character_id": "<CHARACTER ID>",
  "prompt": "<EVALUATION PROMPT>",
  "variables": {
    "customer_name": "Suzie Denver",
    "customer_age": "54 years",
    "item_details": [
      {
        "item": "Burger",
        "price": "$4",
        "quantity": 3
      },
      {
        "item": "Fries",
        "price": "$2",
        "quantity": 2
      }
    ]
  }
}

Example prompt

If you focus on the prompt, there are certain text within [[ ]] . These are expected-variables. Now, [[conversation_history]] is a compulsory expected-variable, that has to be present in the prompt. The rest of them depends on your requirements, to be passed to the prompt as needed.

So the variables key, in the body of the request, should be of length expected-variables - 1, i.e, there should be values for all the other keys mentioned in the [[ ]] brackets, except for conversation_history which is fetched from the session_id provided. The variables list can be empty if you are passing no other expected-variables in the prompt.

Response

On success, the API returns a structured evaluation of the conversation, covering multiple attributes.

Code Snippet

Last updated

Was this helpful?