: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
feat(llma): wire recipe normalizer behind feature flag (#61063)
Carlos Marchalfbb5b2d3c949
diff --git a/common/storybook/webpack.config.js b/common/storybook/webpack.config.jsindex 82ba6be669c8..95787ed6aa31 100644--- a/common/storybook/webpack.config.js+++ b/common/storybook/webpack.config.js@@ -228,8 +228,8 @@ function createEntry(entry) {loader: 'babel-loader',},{- // Apply rule for .sql files- test: /\.sql$/,+ // Load .sql and .yaml files+ test: /\.(sql|yaml)$/,type: 'asset/source',},],diff --git a/frontend/jest.setup.ts b/frontend/jest.setup.tsindex e1ac44bca07a..fc7e37504fa5 100644--- a/frontend/jest.setup.ts+++ b/frontend/jest.setup.ts@@ -153,6 +153,7 @@ jest.mock('posthog-js', () => {identify: jest.fn(),getFeatureFlag: jest.fn(),getFeatureFlagPayload: jest.fn(),+ getFeatureFlagResult: jest.fn(),getAllFlags: jest.fn(),isFeatureEnabled: jest.fn(),getEarlyAccessFeatures: jest.fn(),diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 66aa991b338c..875d4508aaaa 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -331,6 +331,7 @@ export const FEATURE_FLAGS = {LLM_ANALYTICS_EVALUATIONS_REPORTS: 'llm-analytics-evaluations-reports', // owner: #team-ai-observabilityLLM_ANALYTICS_EVALUATIONS_SUMMARY: 'llm-analytics-evaluations-summary', // owner: #team-ai-observabilityLLM_ANALYTICS_OFFLINE_EVALS: 'llm-analytics-offline-evals', // owner: #team-ai-observability+ LLM_ANALYTICS_RECIPE_NORMALIZER: 'llm-analytics-recipe-normalizer', // owner: #team-ai-observabilityLLM_ANALYTICS_SENTIMENT: 'llm-analytics-sentiment', // owner: #team-ai-observabilityLLM_ANALYTICS_SENTIMENT_TAB: 'llm-analytics-sentiment-tab', // owner: #team-ai-observabilityLLM_ANALYTICS_SESSION_SUMMARIZATION: 'llm-analytics-session-summarization', // owner: #team-ai-observabilitydiff --git a/frontend/src/scenes/session-recordings/player/inspector/components/AIEventItems.tsx b/frontend/src/scenes/session-recordings/player/inspector/components/AIEventItems.tsxindex 54680c180640..e57fbcaf4dae 100644--- a/frontend/src/scenes/session-recordings/player/inspector/components/AIEventItems.tsx+++ b/frontend/src/scenes/session-recordings/player/inspector/components/AIEventItems.tsx@@ -10,7 +10,7 @@ import { AIDataLoading } from 'products/ai_observability/frontend/components/AIDimport { ConversationMessagesDisplay } from 'products/ai_observability/frontend/ConversationDisplay/ConversationMessagesDisplay'import { useAIData } from 'products/ai_observability/frontend/hooks/useAIData'import { LLMInputOutput } from 'products/ai_observability/frontend/LLMInputOutput'-import { normalizeMessages } from 'products/ai_observability/frontend/utils'+import { normalizeMessages } from 'products/ai_observability/frontend/messageNormalization'export function AIEventExpanded({ event }: { event: Record<string, any> }): JSX.Element {const { input, output, tools, isLoading } = useAIData({diff --git a/products/ai_observability/frontend/AIObservabilityTraceScene.tsx b/products/ai_observability/frontend/AIObservabilityTraceScene.tsxindex 327a1e3615ce..cad3a237cc5c 100644--- a/products/ai_observability/frontend/AIObservabilityTraceScene.tsx+++ b/products/ai_observability/frontend/AIObservabilityTraceScene.tsx@@ -87,6 +87,7 @@ import { llmGenerationSentimentLazyLoaderLogic } from './llmGenerationSentimentLimport { LLMInputOutput } from './LLMInputOutput'import { llmPersonsLazyLoaderLogic } from './llmPersonsLazyLoaderLogic'import { llmSentimentLazyLoaderLogic } from './llmSentimentLazyLoaderLogic'+import { normalizeMessages } from './messageNormalization'import { openInPlayground } from './playground/llmPlaygroundPromptsLogic'import { ReviewQueuePickerModal } from './reviewQueues/ReviewQueuePickerModal'import { reviewQueuesApi } from './reviewQueues/reviewQueuesApi'@@ -113,7 +114,6 @@ import {getTraceTimestamp,hasCostBreakdown,isLLMEvent,- normalizeMessages,removeMilliseconds,sanitizeTraceUrlSearchParams,} from './utils'diff --git a/products/ai_observability/frontend/AIObservabilityTracesScene.tsx b/products/ai_observability/frontend/AIObservabilityTracesScene.tsxindex 0a02c737ae7e..0be69fc3d15d 100644--- a/products/ai_observability/frontend/AIObservabilityTracesScene.tsx+++ b/products/ai_observability/frontend/AIObservabilityTracesScene.tsx@@ -21,6 +21,7 @@ import { isTracesQuery } from '~/queries/utils'import { aiObservabilityColumnRenderers } from './aiObservabilityColumnRenderers'import { buildApplyUrlStatePayload, aiObservabilitySharedLogic } from './aiObservabilitySharedLogic'import { LLMMessageDisplay } from './ConversationDisplay/ConversationMessagesDisplay'+import { normalizeMessages } from './messageNormalization'import { aiObservabilityTracesTabLogic } from './tabs/aiObservabilityTracesTabLogic'import { TraceMessages, traceMessagesLazyLoaderLogic } from './traceMessagesLazyLoaderLogic'import { traceReviewsLazyLoaderLogic } from './traceReviews/traceReviewsLazyLoaderLogic'@@ -31,7 +32,6 @@ import {formatLLMUsage,getTraceTimestamp,LLM_TRACES_PAGE_SIZE,- normalizeMessages,sanitizeTraceUrlSearchParams,} from './utils'diff --git a/products/ai_observability/frontend/ConversationDisplay/ConversationDisplay.tsx b/products/ai_observability/frontend/ConversationDisplay/ConversationDisplay.tsxindex 3d2a6871dcb4..246c0d619038 100644--- a/products/ai_observability/frontend/ConversationDisplay/ConversationDisplay.tsx+++ b/products/ai_observability/frontend/ConversationDisplay/ConversationDisplay.tsx@@ -8,8 +8,9 @@ import { EventType } from '~/types'import { AIDataLoading } from '../components/AIDataLoading'import { buildInputSourceIndices } from '../extractSessionTurns'import { useAIData } from '../hooks/useAIData'+import { normalizeMessages } from '../messageNormalization'import { openInPlayground } from '../playground/llmPlaygroundPromptsLogic'-import { costContextFromProperties, normalizeMessages } from '../utils'+import { costContextFromProperties } from '../utils'import { ConversationMessagesDisplay } from './ConversationMessagesDisplay'import { MetadataHeader } from './MetadataHeader'diff --git a/products/ai_observability/frontend/aiObservabilityColumnRenderers.tsx b/products/ai_observability/frontend/aiObservabilityColumnRenderers.tsxindex eec9f6a8f6f1..14287296a072 100644--- a/products/ai_observability/frontend/aiObservabilityColumnRenderers.tsx+++ b/products/ai_observability/frontend/aiObservabilityColumnRenderers.tsx@@ -23,10 +23,11 @@ import { EventData, useAIData } from './hooks/useAIData'import { llmGenerationSentimentLazyLoaderLogic } from './llmGenerationSentimentLazyLoaderLogic'import { llmPersonsLazyLoaderLogic } from './llmPersonsLazyLoaderLogic'import { llmSentimentLazyLoaderLogic } from './llmSentimentLazyLoaderLogic'+import { normalizeMessages } from './messageNormalization'import { traceReviewsLazyLoaderLogic } from './traceReviews/traceReviewsLazyLoaderLogic'import { TraceReviewValue } from './traceReviews/TraceReviewValue'import { CompatMessage } from './types'-import { normalizeMessages, parseJSONPreview } from './utils'+import { parseJSONPreview } from './utils'const truncateValue = (value: string): string => {if (value.length > 8) {diff --git a/products/ai_observability/frontend/aiObservabilityTraceDataLogic.ts b/products/ai_observability/frontend/aiObservabilityTraceDataLogic.tsindex a9a94a68f168..b18419d731c3 100644--- a/products/ai_observability/frontend/aiObservabilityTraceDataLogic.ts+++ b/products/ai_observability/frontend/aiObservabilityTraceDataLogic.ts@@ -24,6 +24,7 @@ import type { aiObservabilityTraceDataLogicType } from './aiObservabilityTraceDaimport { aiObservabilityTraceLogic } from './aiObservabilityTraceLogic'import { llmPersonsLazyLoaderLogic } from './llmPersonsLazyLoaderLogic'import { llmSentimentLazyLoaderLogic } from './llmSentimentLazyLoaderLogic'+import { normalizeMessages } from './messageNormalization'import {SearchOccurrence,eventMatchesSearch,@@ -32,7 +33,7 @@ import {findTraceOccurrences,} from './searchUtils'import { SENTIMENT_DATE_WINDOW_DAYS } from './sentimentUtils'-import { formatLLMUsage, getEventType, getSessionID, isLLMEvent, normalizeMessages } from './utils'+import { formatLLMUsage, getEventType, getSessionID, isLLMEvent } from './utils'export interface TraceDataLogicProps {traceId: stringdiff --git a/products/ai_observability/frontend/components/EventContentWithAsyncData.tsx b/products/ai_observability/frontend/components/EventContentWithAsyncData.tsxindex cb357952c01a..fa5379cbad28 100644--- a/products/ai_observability/frontend/components/EventContentWithAsyncData.tsx+++ b/products/ai_observability/frontend/components/EventContentWithAsyncData.tsx@@ -5,7 +5,7 @@ import {ConversationMessagesDisplay,} from '../ConversationDisplay/ConversationMessagesDisplay'import { useAIData } from '../hooks/useAIData'-import { normalizeMessage, normalizeMessages } from '../utils'+import { normalizeMessage, normalizeMessages } from '../messageNormalization'import { AIDataLoading } from './AIDataLoading'import { JSONValueDisplay } from './JSONValueDisplay'diff --git a/products/ai_observability/frontend/extractSessionTurns.ts b/products/ai_observability/frontend/extractSessionTurns.tsindex ff6abcc91e7e..70cd56908738 100644--- a/products/ai_observability/frontend/extractSessionTurns.ts+++ b/products/ai_observability/frontend/extractSessionTurns.ts@@ -1,16 +1,9 @@import { LLMTrace, LLMTraceEvent } from '~/queries/schema/schema-general'+import { normalizeMessage, normalizeMessages } from './messageNormalization'import { messageSignature } from './messageSignature'import { CompatMessage } from './types'-import {- eventLabel,- formatAiErrorForDisplay,- getToolNamesCalled,- normalizeMessage,- normalizeMessages,- readAiInput,- readAiOutput,-} from './utils'+import { eventLabel, formatAiErrorForDisplay, getToolNamesCalled, readAiInput, readAiOutput } from './utils'// Heuristic mirrors the AI observability skill script `print_summary.py` at// `products/ai_observability/skills/exploring-llm-traces/scripts/` — keep in sync.diff --git a/products/ai_observability/frontend/messageNormalization.test.ts b/products/ai_observability/frontend/messageNormalization.test.tsnew file mode 100644index 000000000000..b66f33fc6ccb--- /dev/null+++ b/products/ai_observability/frontend/messageNormalization.test.ts@@ -0,0 +1,147 @@+import posthog, { JsonType } from 'posthog-js'++import { CompatMessage } from './types'++const mockRecipeNormalizeMessage = jest.fn()+const mockRecipeNormalizeMessages = jest.fn()++jest.mock('./normalizer', () => ({+ RecipeNormalizer: jest.fn().mockImplementation(() => ({+ normalizeMessage: mockRecipeNormalizeMessage,+ normalizeMessages: mockRecipeNormalizeMessages,+ })),+}))++jest.mock('./utils', () => ({+ normalizeMessage: jest.fn(),+ normalizeMessages: jest.fn(),+}))++import { normalizeMessage, normalizeMessages } from './messageNormalization'+import { normalizeMessage as legacyNormalizeMessage, normalizeMessages as legacyNormalizeMessages } from './utils'++const LEGACY: CompatMessage[] = [{ role: 'user', content: 'legacy' }]+const RECIPE: CompatMessage[] = [{ role: 'user', content: 'recipe' }]++const legacy = jest.mocked(legacyNormalizeMessages)+const legacyOne = jest.mocked(legacyNormalizeMessage)+const getFeatureFlagResult = jest.mocked(posthog.getFeatureFlagResult)+const capture = jest.mocked(posthog.capture)++function mockFlag(enabled: boolean, payload?: JsonType): void {+ getFeatureFlagResult.mockReturnValue({ key: 'recipe-normalizer', enabled, variant: undefined, payload })+}++beforeEach(() => {+ jest.clearAllMocks()+ legacy.mockReturnValue(LEGACY)+ legacyOne.mockReturnValue(LEGACY)+ mockRecipeNormalizeMessages.mockReturnValue(RECIPE)+ mockRecipeNormalizeMessage.mockReturnValue(RECIPE)+})++describe('messageNormalization — switch (unsampled) path', () => {+ beforeEach(() => jest.spyOn(Math, 'random').mockReturnValue(0.5))++ it('runs only the legacy implementation when the flag is off', () => {+ mockFlag(false)+ expect(normalizeMessages({ role: 'user' }, 'user')).toBe(LEGACY)+ expect(mockRecipeNormalizeMessages).not.toHaveBeenCalled()+ })++ it('runs only the recipe implementation when the flag is on', () => {+ mockFlag(true)+ expect(normalizeMessages({ role: 'user' }, 'user')).toBe(RECIPE)+ expect(legacy).not.toHaveBeenCalled()+ })++ it('falls back to legacy and reports when the recipe implementation throws', () => {+ mockFlag(true)+ mockRecipeNormalizeMessages.mockImplementation(() => {+ throw new Error('no recipe matched')+ })+ expect(normalizeMessages({ role: 'user' }, 'user')).toBe(LEGACY)+ expect(capture).toHaveBeenCalledWith('llma recipe normalization fell back', {+ error: 'no recipe matched',+ })+ })++ it('does not emit a timing event off the sampled path', () => {+ mockFlag(false)+ normalizeMessages({ role: 'user' }, 'user')+ expect(capture).not.toHaveBeenCalledWith('llma normalization timed', expect.anything())+ })++ it('honors a higher sample_rate from the flag payload to force the sampled path', () => {+ mockFlag(true, { sample_rate: 1 })+ normalizeMessages({ role: 'user' }, 'user')+ expect(capture).toHaveBeenCalledWith('llma normalization timed', expect.anything())+ })+})++describe('messageNormalization — shadow (sampled) path', () => {+ beforeEach(() => jest.spyOn(Math, 'random').mockReturnValue(0))++ it('runs both implementations and captures a timing comparison', () => {+ mockFlag(false)+ normalizeMessages({ role: 'user' }, 'user', [{ name: 'search' }])+ expect(legacy).toHaveBeenCalledTimes(1)+ expect(mockRecipeNormalizeMessages).toHaveBeenCalledTimes(1)+ expect(capture).toHaveBeenCalledWith(+ 'llma normalization timed',+ expect.objectContaining({+ op: 'normalizeMessages',+ active_implementation: 'legacy',+ default_role: 'user',+ has_tools: true,+ recipe_errored: false,+ outputs_match: false,+ message_count: 1,+ legacy_duration_ms: expect.any(Number),+ recipe_duration_ms: expect.any(Number),+ })+ )+ })++ it('reports outputs_match true when both implementations agree', () => {+ mockFlag(true)+ mockRecipeNormalizeMessages.mockReturnValue([{ role: 'user', content: 'legacy' }])+ normalizeMessages({ role: 'user' }, 'user')+ expect(capture).toHaveBeenCalledWith(+ 'llma normalization timed',+ expect.objectContaining({ outputs_match: true })+ )+ })++ it('returns the flag-selected recipe result while still timing legacy', () => {+ mockFlag(true)+ expect(normalizeMessages({ role: 'user' }, 'user')).toBe(RECIPE)+ })++ it('records recipe_errored and returns legacy when the recipe throws', () => {+ mockFlag(true)+ mockRecipeNormalizeMessages.mockImplementation(() => {+ throw new Error('boom')+ })+ expect(normalizeMessages({ role: 'user' }, 'user')).toBe(LEGACY)+ expect(capture).toHaveBeenCalledWith(+ 'llma normalization timed',+ expect.objectContaining({ recipe_errored: true, recipe_duration_ms: null, outputs_match: null })+ )+ })++ it('tags the singular normalizeMessage path with its op', () => {+ mockFlag(false)+ normalizeMessage({ role: 'user' }, 'user')+ expect(capture).toHaveBeenCalledWith(+ 'llma normalization timed',+ expect.objectContaining({ op: 'normalizeMessage' })+ )+ })++ it('honors a lower sample_rate from the flag payload to suppress timing', () => {+ mockFlag(true, { sample_rate: 0 })+ normalizeMessages({ role: 'user' }, 'user')+ expect(capture).not.toHaveBeenCalledWith('llma normalization timed', expect.anything())+ })+})diff --git a/products/ai_observability/frontend/messageNormalization.ts b/products/ai_observability/frontend/messageNormalization.tsnew file mode 100644index 000000000000..046ee7c85f51--- /dev/null+++ b/products/ai_observability/frontend/messageNormalization.ts@@ -0,0 +1,123 @@+import posthog, { JsonType } from 'posthog-js'++import { FEATURE_FLAGS } from 'lib/constants'+import { objectsEqual, removeUndefinedAndNull } from 'lib/utils'++import { RecipeNormalizer } from './normalizer'+import { CompatMessage } from './types'+import { normalizeMessage as legacyNormalizeMessage, normalizeMessages as legacyNormalizeMessages } from './utils'++// Constructed once: the constructor compiles and sorts every recipe, so per-call+// construction would dwarf the work we're measuring.+const recipeNormalizer = new RecipeNormalizer()++// Normalization runs once per rendered message; sample so timing doesn't flood ingestion.+const DEFAULT_TIMING_SAMPLE_RATE = 0.01++function timingSampleRate(payload: JsonType | undefined): number {+ if (payload && typeof payload === 'object' && 'sample_rate' in payload) {+ const rate = Number(payload.sample_rate)+ if (Number.isFinite(rate) && rate >= 0 && rate <= 1) {+ return rate+ }+ }+ return DEFAULT_TIMING_SAMPLE_RATE+}++export function normalizeMessage(input: unknown, defaultRole: string): CompatMessage[] {+ return dispatch(+ () => legacyNormalizeMessage(input, defaultRole),+ () => recipeNormalizer.normalizeMessage(input, defaultRole),+ { op: 'normalizeMessage', default_role: defaultRole }+ )+}++export function normalizeMessages(input: unknown, defaultRole: string, tools?: unknown): CompatMessage[] {+ return dispatch(+ () => legacyNormalizeMessages(input, defaultRole, tools),+ () => recipeNormalizer.normalizeMessages(input, defaultRole, tools),+ { op: 'normalizeMessages', default_role: defaultRole, has_tools: tools != null }+ )+}++function dispatch(+ legacy: () => CompatMessage[],+ recipe: () => CompatMessage[],+ context: Record<string, unknown>+): CompatMessage[] {+ const flag = posthog.getFeatureFlagResult(FEATURE_FLAGS.LLM_ANALYTICS_RECIPE_NORMALIZER)+ const useRecipe = !!flag?.enabled++ if (Math.random() >= timingSampleRate(flag?.payload)) {+ return useRecipe ? runRecipe(recipe, legacy) : legacy()+ }+ return shadow(legacy, recipe, useRecipe, context)+}++// The recipe normalizer throws on a coverage gap; fall back so a normalizer bug+// can never break trace rendering.+function runRecipe(recipe: () => CompatMessage[], legacy: () => CompatMessage[]): CompatMessage[] {+ try {+ return recipe()+ } catch (error) {+ posthog.capture('llma recipe normalization fell back', {+ error: error instanceof Error ? error.message : String(error),+ })+ return legacy()+ }+}++function shadow(+ legacy: () => CompatMessage[],+ recipe: () => CompatMessage[],+ useRecipe: boolean,+ context: Record<string, unknown>+): CompatMessage[] {+ const legacyRun = time(legacy)+ const recipeRun = timeSafe(recipe)+ // Strip nullish-valued keys before comparing, so an explicit `undefined`+ // field (e.g. legacy's `tool_call_id: undefined`) counts as equal to an+ // absent one — smooths over quirks in the legacy implementation+ const outputsMatch = recipeRun.ok+ ? objectsEqual(removeUndefinedAndNull(legacyRun.result), removeUndefinedAndNull(recipeRun.result))+ : null++ posthog.capture('llma normalization timed', {+ ...context,+ active_implementation: useRecipe ? 'recipe' : 'legacy',+ legacy_duration_ms: legacyRun.durationMs,+ recipe_duration_ms: recipeRun.ok ? recipeRun.durationMs : null,+ recipe_errored: !recipeRun.ok,+ outputs_match: outputsMatch,+ message_count: legacyRun.result.length,+ })++ return useRecipe && recipeRun.ok ? recipeRun.result : legacyRun.result+}++interface TimedRun {+ result: CompatMessage[]+ durationMs: number+}++type SafeRun = (TimedRun & { ok: true }) | { ok: false }++function time(fn: () => CompatMessage[]): TimedRun {+ const start = performance.now()+ const result = fn()+ return { result, durationMs: roundMs(performance.now() - start) }+}++function timeSafe(fn: () => CompatMessage[]): SafeRun {+ const start = performance.now()+ try {+ const result = fn()+ return { ok: true, result, durationMs: roundMs(performance.now() - start) }+ } catch {+ return { ok: false }+ }+}++function roundMs(ms: number): number {+ return Math.round(ms * 1000) / 1000+}diff --git a/products/ai_observability/frontend/normalizer/index.ts b/products/ai_observability/frontend/normalizer/index.tsindex f9d4020bfd90..0fbaeb838b2c 100644--- a/products/ai_observability/frontend/normalizer/index.ts+++ b/products/ai_observability/frontend/normalizer/index.ts@@ -1,4 +1,5 @@-// Parallel to `../utils`, which stays the only production path; this is-// exercised by the test suite, awaiting a feature flag to dual-run in prod.+// Recipe-based parallel to the legacy `../utils` normalizer. Production routes+// through `../messageNormalization`, which flag-switches between the two; this+// module is also exercised directly by the parity test suite.export { RecipeNormalizer } from './recipe/recipeNormalizer'diff --git a/products/ai_observability/frontend/normalizer/recipe/recipeNormalizer.ts b/products/ai_observability/frontend/normalizer/recipe/recipeNormalizer.tsindex 5d323d35e9f2..62bea28a6151 100644--- a/products/ai_observability/frontend/normalizer/recipe/recipeNormalizer.ts+++ b/products/ai_observability/frontend/normalizer/recipe/recipeNormalizer.ts@@ -1,5 +1,5 @@import { CompatMessage } from '../../types'-import { AVAILABLE_TOOLS_ROLE, safeStringify } from '../../utils'+import { AVAILABLE_TOOLS_ROLE } from '../../utils'import { loadRecipes } from './registry'import { NO_MATCH, RecipePipeline } from './runtime/pipeline'@@ -19,9 +19,7 @@ export class RecipeNormalizer {const result = this.pipeline.run(input, defaultRole)if (result === NO_MATCH) {// cajole.yaml matches anything, so NO_MATCH means a coverage gap, not a normal miss.- throw new Error(- `RecipeNormalizer: no recipe matched ${safeStringify(input, 0).slice(0, 200)} — cajole.yaml should be the final catch-all`- )+ throw new Error(`RecipeNormalizer: no recipe matched — cajole.yaml should be the final catch-all`)}return result}diff --git a/products/ai_observability/frontend/playground/llmPlaygroundPromptsLogic.ts b/products/ai_observability/frontend/playground/llmPlaygroundPromptsLogic.tsindex 51927d157e8d..b21a8b1f3afb 100644--- a/products/ai_observability/frontend/playground/llmPlaygroundPromptsLogic.ts+++ b/products/ai_observability/frontend/playground/llmPlaygroundPromptsLogic.ts@@ -12,9 +12,10 @@ import { urls } from 'scenes/urls'import { llmEvaluationLogic } from '../evaluations/llmEvaluationLogic'import type { EvaluationConfig } from '../evaluations/types'+import { normalizeMessage } from '../messageNormalization'import { getApiErrorDetail, llmPromptLogic } from '../prompts/llmPromptLogic'import { normalizeLLMProvider } from '../settings/llmProviderKeysLogic'-import { isOTelPartsMessage, normalizeMessage, normalizeRole, safeStringify } from '../utils'+import { isOTelPartsMessage, normalizeRole, safeStringify } from '../utils'import type { llmPlaygroundPromptsLogicType } from './llmPlaygroundPromptsLogicType'import { isTraceLikeSelection } from './playgroundModelMatching'diff --git a/products/ai_observability/frontend/sessionTitle.ts b/products/ai_observability/frontend/sessionTitle.tsindex 7dbb2e1f1abc..d5b0415f5e88 100644--- a/products/ai_observability/frontend/sessionTitle.ts+++ b/products/ai_observability/frontend/sessionTitle.ts@@ -1,7 +1,8 @@import { LLMTrace, LLMTraceEvent } from '~/queries/schema/schema-general'+import { normalizeMessages } from './messageNormalization'import { CompatMessage } from './types'-import { extractTextContent, hasStringContentField, normalizeMessages, readAiInput } from './utils'+import { extractTextContent, hasStringContentField, readAiInput } from './utils'const GENERIC_TRACE_NAMES = new Set(['langgraph', 'runnablesequence', 'chatprompttemplate'])diff --git a/products/ai_observability/frontend/tabs/AIObservabilitySentiment.tsx b/products/ai_observability/frontend/tabs/AIObservabilitySentiment.tsxindex 9297f3f347bb..b667a2e86a7d 100644--- a/products/ai_observability/frontend/tabs/AIObservabilitySentiment.tsx+++ b/products/ai_observability/frontend/tabs/AIObservabilitySentiment.tsx@@ -8,10 +8,11 @@ import { LemonSlider } from 'lib/lemon-ui/LemonSlider'import { urls } from 'scenes/urls'import { MessageSentimentBar, SENTIMENT_BAR_COLOR } from '../components/SentimentTag'+import { normalizeMessages } from '../messageNormalization'import { extractContentText, formatScore } from '../sentimentUtils'import type { SentimentLabel } from '../sentimentUtils'import type { CompatMessage } from '../types'-import { getTraceTimestamp, normalizeMessages } from '../utils'+import { getTraceTimestamp } from '../utils'import type {GroupedSentimentCard,SentimentCard,diff --git a/products/ai_observability/frontend/traceExportUtils.ts b/products/ai_observability/frontend/traceExportUtils.tsindex 08477bb2101b..996edef45ef7 100644--- a/products/ai_observability/frontend/traceExportUtils.ts+++ b/products/ai_observability/frontend/traceExportUtils.ts@@ -4,8 +4,9 @@ import { copyToClipboard } from 'lib/utils/copyToClipboard'import { LLMTrace, LLMTraceEvent } from '~/queries/schema/schema-general'import { EnrichedTraceTreeNode } from './aiObservabilityTraceDataLogic'+import { normalizeMessages } from './messageNormalization'import { CompatMessage } from './types'-import { formatLLMEventTitle, normalizeMessages, readAiOutput } from './utils'+import { formatLLMEventTitle, readAiOutput } from './utils'interface EventMetrics {latency?: number