Skip to main content

Conversation User Sentiment (conv_sent)

Contents​

Metric Description​

Conversation user sentiment measures the listed affect in each user message of a multi-turn chat and returns an overall score for the conversation.

Assistant quality and user feeling are not the same signal. A reply can be on-topic while the user is still confused, distrustful, or ready to leave. Use this metric when you care about the experience of the thread — friction that would show up in CSAT, escalation, or abandonment — independently of whether the assistant’s answers were helpful. It is a user-side check for support and product chats: catch rising negative affect in production logs without scoring the replies themselves.

A score of 100 means the user showed no net negative sentiment. Negative sentiment lowers the score; positive sentiment only offsets negative sentiment and never lifts the score above 100. A fully neutral conversation scores 100.

How to interpret the score​

  • 100: no net negative sentiment (neutral throughout, or positives that fully offset earlier negatives).
  • Closer to 0: stronger or later negative affect (frustration, confusion, dissatisfaction, distrust, or abandonment).
Important

This metric never looks at what the assistant said. It is not an assistant-quality, correctness, tone, or politeness check (that neighbourhood is Conversation Helpfulness). Quoted, hypothetical, negated, and resolved-past feelings are not scored.

API usage​

Prerequisites

The examples call POST /runs/custom. Set AEGIS_API_KEY to your API key and AEGIS_API_BASE_URL to the API base URL, including the /api/v1 prefix (for example https://api.aegisevals.ai/api/v1). For a field-by-field description of the payload (top-level keys, evaluations, and each row in data), see Custom run request body.

Shortname: conv_sent

Default threshold: 80

Inputs (each object in data)

  • input (list[dict] or str, required): The full chat log. A non-empty list of message objects each with role and content, or a JSON string encoding that list. The log must contain exactly two distinct roles, one of which is a user role (user, human, or customer). The other role is treated as the assistant. Extra roles such as system or tool cause evaluation to fail with no score.

Evaluation metadata​

On successful evaluation, the metric returns eval_metadata summarizing which turns carried listed affect:

  • positive_turns (list[int]): Sorted 1-based turn numbers that carried a positive signal.
  • negative_turns (list[int]): Sorted 1-based turn numbers that carried a negative signal. A turn with both polarities is listed under both.
  • sentiments_ratio (dict[str, float]): For each signal that appeared, the share of judged turns carrying it, plus neutral (the share with no listed signal). Values are rounded to 2 decimals. A fully neutral conversation is {"neutral": 1.0} with empty turn lists.

Example

import json
import os

import requests
from dotenv import load_dotenv

load_dotenv(override=True)

_API_KEY = os.getenv("AEGIS_API_KEY")
_BASE_URL = os.getenv("AEGIS_API_BASE_URL")
_CUSTOM_RUN_URL = f"{_BASE_URL}/runs/custom"


def post_custom_run(payload: dict) -> requests.Response:
"""POST JSON payload to Aegis custom runs; returns the raw response."""
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {_API_KEY}",
}
return requests.post(
_CUSTOM_RUN_URL,
headers=headers,
data=json.dumps(payload),
)


if __name__ == "__main__":
conversation = [
{
"role": "user",
"content": "I mentioned mobile earlier — what am I supposed to do?",
},
{
"role": "assistant",
"content": "Open Settings, then tap Account, then Email.",
},
{
"role": "user",
"content": "What's the character limit on the bio field?",
},
{
"role": "assistant",
"content": "The bio field allows up to 160 characters.",
},
{
"role": "user",
"content": "Did you make that up? I still don't see Email.",
},
{
"role": "assistant",
"content": "Email is under Account. Tap the Account row at the top.",
},
{
"role": "user",
"content": "Got it, that's exactly what I needed.",
},
{"role": "assistant", "content": "Glad it helped."},
]
data = [{"input": conversation}]

payload = {
"threshold": 80,
"model_slug": "o4-mini",
"is_blocking": True,
"data_collection_id": None,
"evaluations": [
{
"metrics": ["conv_sent"],
"threshold": 80,
"model_slug": "o4-mini",
"data": data,
}
],
}

response = post_custom_run(payload)
response.raise_for_status()
print(json.dumps(response.json(), indent=2))