Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(aio): disclose that sentiment eval is English-only (#79727)

posthog[bot]f4bf4af855d9
diff --git a/posthog/temporal/ai_observability/sentiment/README.md b/posthog/temporal/ai_observability/sentiment/README.md
index 053bc1818c70..1ccb1df471e0 100644
--- a/posthog/temporal/ai_observability/sentiment/README.md
+++ b/posthog/temporal/ai_observability/sentiment/README.md
@@ -10,6 +10,19 @@ Sentiment AI evaluations run through the evaluation workflow, classify the targe
The AI observability UI reads stored sentiment evaluation events. It does not trigger on-read sentiment classification.
+## Language support
+
+The model (`cardiffnlp/twitter-roberta-base-sentiment-latest`) is trained on English, so labels are
+unreliable for other languages. There is currently no way to pick a different model, so a
+multilingual agent should use an `llm_judge` evaluation for sentiment instead. This limitation is
+disclosed in the eval creation UI, the evaluation API help text, and this README.
+
+A language-aware model option (CardiffNLP publishes a multilingual XLM-RoBERTa sibling that drops
+into the same ONNX pipeline) is a possible follow-up. Adding it means a config field on
+`SentimentEvalConfig`, a second model baked by `bin/download-sentiment-model` and
+`Dockerfile.llm-analytics`, and a dispatch branch in `model.py`. Image size and per-language
+accuracy are worth weighing before picking the exact model.
+
## Package structure
| File | Purpose |
diff --git a/products/ai_observability/backend/api/evaluations.py b/products/ai_observability/backend/api/evaluations.py
index 47f807a94a83..75cd90c9a07b 100644
--- a/products/ai_observability/backend/api/evaluations.py
+++ b/products/ai_observability/backend/api/evaluations.py
@@ -107,7 +107,11 @@ logger = structlog.get_logger(__name__)
"source": {
"type": "string",
"enum": ["user_messages"],
- "description": "Classify sentiment from user messages in the generation input.",
+ "description": (
+ "Classify sentiment from user messages in the generation input. The classifier is "
+ "trained on English, so labels are unreliable for other languages; use an 'llm_judge' "
+ "evaluation for multilingual agents."
+ ),
"default": "user_messages",
}
},
@@ -369,7 +373,8 @@ class EvaluationSerializer(serializers.ModelSerializer):
"evaluation_type": {
"help_text": (
"'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; "
- "'sentiment' classifies user-message sentiment."
+ "'sentiment' classifies user-message sentiment (trained on English, so use 'llm_judge' for "
+ "multilingual agents)."
)
},
"output_type": {
diff --git a/products/ai_observability/backend/models/evaluation_configs.py b/products/ai_observability/backend/models/evaluation_configs.py
index e372d7f3c000..16408b06409a 100644
--- a/products/ai_observability/backend/models/evaluation_configs.py
+++ b/products/ai_observability/backend/models/evaluation_configs.py
@@ -54,7 +54,12 @@ class BooleanOutputConfig(BaseModel):
class SentimentEvalConfig(BaseModel):
- """Configuration for sentiment evaluations."""
+ """Configuration for sentiment evaluations.
+
+ The classifier is an English-trained model, so labels are unreliable for other languages. A
+ multilingual agent should use an llm_judge evaluation instead. See
+ posthog/temporal/ai_observability/sentiment/README.md.
+ """
source: Literal["user_messages"] = Field(
default="user_messages",
diff --git a/products/ai_observability/frontend/AIObservabilityScene.tsx b/products/ai_observability/frontend/AIObservabilityScene.tsx
index a6d5292f4227..0336b6f09468 100644
--- a/products/ai_observability/frontend/AIObservabilityScene.tsx
+++ b/products/ai_observability/frontend/AIObservabilityScene.tsx
@@ -424,7 +424,7 @@ const TAB_DESCRIPTIONS: Record<string, string> = {
users: 'Understand how users are interacting with your AI features.',
errors: 'Monitor and debug errors in your AI pipeline.',
tools: 'See which tools your LLMs are calling and how often.',
- sentiment: 'Scan user messages by sentiment to spot frustration or satisfaction.',
+ sentiment: 'Scan user messages by sentiment to spot frustration or satisfaction. Works best in English.',
sessions: 'Analyze user sessions containing AI interactions.',
}
diff --git a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx
index ea742594975a..22a652020ff1 100644
--- a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx
+++ b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx
@@ -475,7 +475,7 @@ export function AIObservabilityEvaluation(): JSX.Element {
)}
<p className="text-muted text-sm -mt-2">
{isSentiment ? (
- 'Classify the sentiment of only the last user message on each matching generation event with a sentiment classifier, not LLM calls.'
+ 'Classify the sentiment of only the last user message on each matching generation event with a sentiment classifier, not LLM calls. The classifier is trained on English, so labels are unreliable for other languages. For a multilingual agent, use an LLM judge instead.'
) : isHog ? (
<>
Run deterministic{' '}
diff --git a/products/ai_observability/frontend/generated/api.schemas.ts b/products/ai_observability/frontend/generated/api.schemas.ts
index 90144a0d3bae..4adfea0a3bf0 100644
--- a/products/ai_observability/frontend/generated/api.schemas.ts
+++ b/products/ai_observability/frontend/generated/api.schemas.ts
@@ -820,7 +820,7 @@ export type EvaluationApiEvaluationConfig =
source: string
}
| {
- /** Classify sentiment from user messages in the generation input. */
+ /** Classify sentiment from user messages in the generation input. The classifier is trained on English, so labels are unreliable for other languages; use an 'llm_judge' evaluation for multilingual agents. */
source?: 'user_messages'
}
@@ -886,7 +886,7 @@ export interface EvaluationApi {
* @nullable
*/
readonly status_reason_detail: string | null
- /** 'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment.
+ /** 'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment (trained on English, so use 'llm_judge' for multilingual agents).
*
* * `llm_judge` - LLM as a judge
* * `hog` - Hog
@@ -949,7 +949,7 @@ export type PatchedEvaluationApiEvaluationConfig =
source: string
}
| {
- /** Classify sentiment from user messages in the generation input. */
+ /** Classify sentiment from user messages in the generation input. The classifier is trained on English, so labels are unreliable for other languages; use an 'llm_judge' evaluation for multilingual agents. */
source?: 'user_messages'
}
@@ -1015,7 +1015,7 @@ export interface PatchedEvaluationApi {
* @nullable
*/
readonly status_reason_detail?: string | null
- /** 'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment.
+ /** 'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment (trained on English, so use 'llm_judge' for multilingual agents).
*
* * `llm_judge` - LLM as a judge
* * `hog` - Hog
diff --git a/products/ai_observability/frontend/generated/api.zod.ts b/products/ai_observability/frontend/generated/api.zod.ts
index 7c09bcb1db9b..e6cfd6d82e6e 100644
--- a/products/ai_observability/frontend/generated/api.zod.ts
+++ b/products/ai_observability/frontend/generated/api.zod.ts
@@ -264,7 +264,7 @@ export const EvaluationsCreateBody = /* @__PURE__ */ zod.object({
.enum(['llm_judge', 'hog', 'sentiment'])
.describe('\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis')
.describe(
- "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment.\n\n\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis"
+ "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment (trained on English, so use 'llm_judge' for multilingual agents).\n\n\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis"
),
evaluation_config: zod
.union([
@@ -284,7 +284,9 @@ export const EvaluationsCreateBody = /* @__PURE__ */ zod.object({
source: zod
.enum(['user_messages'])
.default(evaluationsCreateBodyEvaluationConfigThreeSourceDefault)
- .describe('Classify sentiment from user messages in the generation input.'),
+ .describe(
+ "Classify sentiment from user messages in the generation input. The classifier is trained on English, so labels are unreliable for other languages; use an 'llm_judge' evaluation for multilingual agents."
+ ),
}),
])
.optional()
@@ -457,7 +459,7 @@ export const EvaluationsUpdateBody = /* @__PURE__ */ zod.object({
.enum(['llm_judge', 'hog', 'sentiment'])
.describe('\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis')
.describe(
- "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment.\n\n\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis"
+ "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment (trained on English, so use 'llm_judge' for multilingual agents).\n\n\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis"
),
evaluation_config: zod
.union([
@@ -477,7 +479,9 @@ export const EvaluationsUpdateBody = /* @__PURE__ */ zod.object({
source: zod
.enum(['user_messages'])
.default(evaluationsUpdateBodyEvaluationConfigThreeSourceDefault)
- .describe('Classify sentiment from user messages in the generation input.'),
+ .describe(
+ "Classify sentiment from user messages in the generation input. The classifier is trained on English, so labels are unreliable for other languages; use an 'llm_judge' evaluation for multilingual agents."
+ ),
}),
])
.optional()
@@ -651,7 +655,7 @@ export const EvaluationsPartialUpdateBody = /* @__PURE__ */ zod.object({
.describe('\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis')
.optional()
.describe(
- "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment.\n\n\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis"
+ "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment (trained on English, so use 'llm_judge' for multilingual agents).\n\n\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis"
),
evaluation_config: zod
.union([
@@ -671,7 +675,9 @@ export const EvaluationsPartialUpdateBody = /* @__PURE__ */ zod.object({
source: zod
.enum(['user_messages'])
.default(evaluationsPartialUpdateBodyEvaluationConfigThreeSourceDefault)
- .describe('Classify sentiment from user messages in the generation input.'),
+ .describe(
+ "Classify sentiment from user messages in the generation input. The classifier is trained on English, so labels are unreliable for other languages; use an 'llm_judge' evaluation for multilingual agents."
+ ),
}),
])
.optional()
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 46b5f8db0e8d..5dacb112d6e6 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -28383,7 +28383,7 @@ export namespace Schemas {
*/
source: string;
} | {
- /** Classify sentiment from user messages in the generation input. */
+ /** Classify sentiment from user messages in the generation input. The classifier is trained on English, so labels are unreliable for other languages; use an 'llm_judge' evaluation for multilingual agents. */
source?: 'user_messages';
};
@@ -28590,7 +28590,7 @@ export namespace Schemas {
* @nullable
*/
readonly status_reason_detail: string | null;
- /** 'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment.
+ /** 'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment (trained on English, so use 'llm_judge' for multilingual agents).
*
* * `llm_judge` - LLM as a judge
* * `hog` - Hog
@@ -54493,7 +54493,7 @@ export namespace Schemas {
*/
source: string;
} | {
- /** Classify sentiment from user messages in the generation input. */
+ /** Classify sentiment from user messages in the generation input. The classifier is trained on English, so labels are unreliable for other languages; use an 'llm_judge' evaluation for multilingual agents. */
source?: 'user_messages';
};
@@ -54557,7 +54557,7 @@ export namespace Schemas {
* @nullable
*/
readonly status_reason_detail?: string | null;
- /** 'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment.
+ /** 'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment (trained on English, so use 'llm_judge' for multilingual agents).
*
* * `llm_judge` - LLM as a judge
* * `hog` - Hog
diff --git a/services/mcp/src/generated/ai_observability/api.ts b/services/mcp/src/generated/ai_observability/api.ts
index a296ee62144c..46db81dad124 100644
--- a/services/mcp/src/generated/ai_observability/api.ts
+++ b/services/mcp/src/generated/ai_observability/api.ts
@@ -594,7 +594,7 @@ export const EvaluationsCreateBody = /* @__PURE__ */ zod.object({
.enum(['llm_judge', 'hog', 'sentiment'])
.describe('\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis')
.describe(
- "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment.\n\n\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis"
+ "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment (trained on English, so use 'llm_judge' for multilingual agents).\n\n\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis"
),
evaluation_config: zod
.union([
@@ -614,7 +614,9 @@ export const EvaluationsCreateBody = /* @__PURE__ */ zod.object({
source: zod
.enum(['user_messages'])
.default(evaluationsCreateBodyEvaluationConfigThreeSourceDefault)
- .describe('Classify sentiment from user messages in the generation input.'),
+ .describe(
+ "Classify sentiment from user messages in the generation input. The classifier is trained on English, so labels are unreliable for other languages; use an 'llm_judge' evaluation for multilingual agents."
+ ),
}),
])
.optional()
@@ -806,7 +808,7 @@ export const EvaluationsPartialUpdateBody = /* @__PURE__ */ zod.object({
.describe('\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis')
.optional()
.describe(
- "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment.\n\n\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis"
+ "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment (trained on English, so use 'llm_judge' for multilingual agents).\n\n\* `llm_judge` - LLM as a judge\n\* `hog` - Hog\n\* `sentiment` - Sentiment analysis"
),
evaluation_config: zod
.union([
@@ -826,7 +828,9 @@ export const EvaluationsPartialUpdateBody = /* @__PURE__ */ zod.object({
source: zod
.enum(['user_messages'])
.default(evaluationsPartialUpdateBodyEvaluationConfigThreeSourceDefault)
- .describe('Classify sentiment from user messages in the generation input.'),
+ .describe(
+ "Classify sentiment from user messages in the generation input. The classifier is trained on English, so labels are unreliable for other languages; use an 'llm_judge' evaluation for multilingual agents."
+ ),
}),
])
.optional()
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-create.json
index acdc036c303e..2763f8ba56fd 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-create.json
@@ -86,7 +86,7 @@
"properties": {
"source": {
"default": "user_messages",
- "description": "Classify sentiment from user messages in the generation input.",
+ "description": "Classify sentiment from user messages in the generation input. The classifier is trained on English, so labels are unreliable for other languages; use an 'llm_judge' evaluation for multilingual agents.",
"enum": ["user_messages"],
"type": "string"
}
@@ -97,7 +97,7 @@
"description": "Configuration dict. For 'llm_judge': {prompt}; for 'hog': {source}; for 'sentiment': {source: 'user_messages'}."
},
"evaluation_type": {
- "description": "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment.\n\n* `llm_judge` - LLM as a judge\n* `hog` - Hog\n* `sentiment` - Sentiment analysis",
+ "description": "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment (trained on English, so use 'llm_judge' for multilingual agents).\n\n* `llm_judge` - LLM as a judge\n* `hog` - Hog\n* `sentiment` - Sentiment analysis",
"enum": ["llm_judge", "hog", "sentiment"],
"type": "string"
},
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-update.json
index 529ceb800f95..f23350b88904 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-evaluation-update.json
@@ -86,7 +86,7 @@
"properties": {
"source": {
"default": "user_messages",
- "description": "Classify sentiment from user messages in the generation input.",
+ "description": "Classify sentiment from user messages in the generation input. The classifier is trained on English, so labels are unreliable for other languages; use an 'llm_judge' evaluation for multilingual agents.",
"enum": ["user_messages"],
"type": "string"
}
@@ -97,7 +97,7 @@
"description": "Configuration dict. For 'llm_judge': {prompt}; for 'hog': {source}; for 'sentiment': {source: 'user_messages'}."
},
"evaluation_type": {
- "description": "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment.\n\n* `llm_judge` - LLM as a judge\n* `hog` - Hog\n* `sentiment` - Sentiment analysis",
+ "description": "'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment (trained on English, so use 'llm_judge' for multilingual agents).\n\n* `llm_judge` - LLM as a judge\n* `hog` - Hog\n* `sentiment` - Sentiment analysis",
"enum": ["llm_judge", "hog", "sentiment"],
"type": "string"
},