: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(llma): stop TypeError on every field blur in the evaluation form (#89044)
Carlos Marchal69868be6d48f
diff --git a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsxindex 1b756207c2c0..85860d0bb475 100644--- a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx+++ b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx@@ -1,5 +1,4 @@import { useActions, useValues } from 'kea'-import { Field, Form } from 'kea-forms'import { combineUrl, router } from 'kea-router'import { useRef } from 'react'@@ -22,6 +21,7 @@ import { AccessControlAction } from 'lib/components/AccessControlAction'import { DurationPicker } from 'lib/components/DurationPicker/DurationPicker'import { NotFound } from 'lib/components/NotFound'import { FEATURE_FLAGS } from 'lib/constants'+import { LemonField } from 'lib/lemon-ui/LemonField'import { lemonToast } from 'lib/lemon-ui/LemonToast'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { SceneExport } from 'scenes/sceneTypes'@@ -465,30 +465,30 @@ export function AIObservabilityEvaluation(): JSX.Element {'data-attr': 'llma-evaluation-configuration-tab',content: (<div className="max-w-4xl">- <Form logic={llmEvaluationLogic} formKey="evaluation" className="space-y-6">+ <div className="space-y-6">{/* Basic Information */}<div className="bg-bg-light border rounded p-6"><h3 className="text-lg font-semibold mb-4">Basic information</h3><div className="space-y-4">- <Field name="name" label="Name">+ <LemonField.Pure label="Name"><LemonInputvalue={evaluation.name}onChange={setEvaluationName}placeholder="e.g., Helpfulness Check"maxLength={100}/>- </Field>+ </LemonField.Pure>{evaluationMethodOptions.length > 1 && (- <Field name="evaluation_type" label="Method">+ <LemonField.Pure label="Method"><LemonSelectvalue={evaluation.evaluation_type}onChange={(value) => setEvaluationType(value as EvaluationType)}options={evaluationMethodOptions}fullWidth/>- </Field>+ </LemonField.Pure>)}<p className="text-muted text-sm -mt-2">{isSentiment ? (@@ -520,7 +520,7 @@ export function AIObservabilityEvaluation(): JSX.Element {{!isSentiment && (<>- <Field name="target" label="Evaluate">+ <LemonField.Pure label="Evaluate"><LemonSelect<EvaluationTarget>value={evaluation.target ?? 'generation'}onChange={setEvaluationTarget}@@ -544,7 +544,7 @@ export function AIObservabilityEvaluation(): JSX.Element {]}fullWidth/>- </Field>+ </LemonField.Pure><p className="text-muted text-sm -mt-2">{isSessionTarget? 'Runs once per session on every trace it contains, after the session settles. Only fires for events that carry an AI session id.'@@ -555,7 +555,7 @@ export function AIObservabilityEvaluation(): JSX.Element {{isAggregateTarget && (<>{settlingStrategyEnabled && (- <Field name="settle_strategy" label="Evaluate when">+ <LemonField.Pure label="Evaluate when"><LemonSelect<EvaluationSettleStrategy>value={effectiveStrategy}onChange={setSettleStrategy}@@ -573,13 +573,10 @@ export function AIObservabilityEvaluation(): JSX.Element {]}fullWidth/>- </Field>+ </LemonField.Pure>)}{effectiveStrategy === 'fixed_window' ? (- <Field- name="settle_window"- label="Wait before evaluating"- >+ <LemonField.Pure label="Wait before evaluating"><div className="space-y-1"><DurationPickervalue={@@ -607,13 +604,10 @@ export function AIObservabilityEvaluation(): JSX.Element {: "How long to wait after the first matching generation before pulling the whole trace (10s–2h). Captured when the run is scheduled — changing it won't affect trace runs already in flight."}</p></div>- </Field>+ </LemonField.Pure>) : (<>- <Field- name="settle_quiet_period"- label="Quiet period"- >+ <LemonField.Pure label="Quiet period"><div className="space-y-1"><DurationPickervalue={@@ -635,8 +629,8 @@ export function AIObservabilityEvaluation(): JSX.Element {: 'Evaluate once the trace has had no new activity for this long (10s–30m).'}</p></div>- </Field>- <Field name="settle_max_age" label="Evaluate by">+ </LemonField.Pure>+ <LemonField.Pure label="Evaluate by"><div className="space-y-1"><DurationPickervalue={@@ -658,7 +652,7 @@ export function AIObservabilityEvaluation(): JSX.Element {: "Always evaluate once the trace is this old, even if it's still active (1m–2h)."}</p></div>- </Field>+ </LemonField.Pure></>)}</>@@ -666,7 +660,7 @@ export function AIObservabilityEvaluation(): JSX.Element {</>)}- <Field name="description" label="Description (optional)">+ <LemonField.Pure label="Description (optional)"><LemonTextAreavalue={evaluation.description || ''}onChange={setEvaluationDescription}@@ -674,7 +668,7 @@ export function AIObservabilityEvaluation(): JSX.Element {rows={2}maxLength={500}/>- </Field>+ </LemonField.Pure><div className="flex items-center gap-2"><Tooltip@@ -700,8 +694,7 @@ export function AIObservabilityEvaluation(): JSX.Element {</div>{isBooleanOutput && (- <Field- name="allows_na"+ <LemonField.Purelabel={<div className="flex items-center gap-1"><span>Allow N/A responses</span>@@ -732,7 +725,7 @@ export function AIObservabilityEvaluation(): JSX.Element {: 'Evaluation returns true or false'}</span></div>- </Field>+ </LemonField.Pure>)}</div></div>@@ -765,7 +758,7 @@ export function AIObservabilityEvaluation(): JSX.Element {{isNewEvaluation && isReportableEvaluation && (<EvaluationReportConfig evaluationId="new" />)}- </Form>+ </div>{/* Scheduled Reports (for existing evaluations, outside the form) */}{!isNewEvaluation && isReportableEvaluation && (@@ -803,7 +796,7 @@ function EvaluationModelPicker(): JSX.Element {</p><div className="space-y-4">- <Field name="model" label="Model">+ <LemonField.Pure label="Model"><div><ModelPickermodel={selectedModel}@@ -819,7 +812,7 @@ function EvaluationModelPicker(): JSX.Element {<p className="text-sm text-danger mt-1">Select a judge model.</p>)}</div>- </Field>+ </LemonField.Pure></div></div>)diff --git a/products/ai_observability/frontend/evaluations/components/EvaluationPromptEditor.tsx b/products/ai_observability/frontend/evaluations/components/EvaluationPromptEditor.tsxindex 0e8d8d56015c..b1f26462358b 100644--- a/products/ai_observability/frontend/evaluations/components/EvaluationPromptEditor.tsx+++ b/products/ai_observability/frontend/evaluations/components/EvaluationPromptEditor.tsx@@ -1,8 +1,9 @@import { useActions, useValues } from 'kea'-import { Field } from 'kea-forms'import { LemonTag, LemonTextArea } from '@posthog/lemon-ui'+import { LemonField } from 'lib/lemon-ui/LemonField'+import { llmEvaluationLogic } from '../llmEvaluationLogic'export function EvaluationPromptEditor(): JSX.Element {@@ -18,7 +19,7 @@ export function EvaluationPromptEditor(): JSX.Element {return (<div className="space-y-4">- <Field name="prompt" label="Evaluation prompt">+ <LemonField.Pure label="Evaluation prompt"><div className="space-y-2"><LemonTextAreavalue={prompt}@@ -46,7 +47,7 @@ Example: Is this response helpful and accurate? Return true if yes, false if no.</div></div></div>- </Field>+ </LemonField.Pure>{prompt.length > 0 && (<div className="bg-bg-light border rounded p-3">