: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): trace input/output preview from ai_events (#58114)
Carlos Marchal7839b1e4d735
diff --git a/products/llm_analytics/frontend/traceMessagesLazyLoaderLogic.ts b/products/llm_analytics/frontend/traceMessagesLazyLoaderLogic.tsindex ec701fcb99c6..3d3695fd24a0 100644--- a/products/llm_analytics/frontend/traceMessagesLazyLoaderLogic.ts+++ b/products/llm_analytics/frontend/traceMessagesLazyLoaderLogic.ts@@ -195,34 +195,34 @@ export const traceMessagesLazyLoaderLogic = kea<traceMessagesLazyLoaderLogicTypekind: NodeKind.HogQLQuery,query: `SELECT- properties.$ai_trace_id AS trace_id,+ trace_id,anyIf(- substring(toString(properties.$ai_input_state), 1, ${FIELD_TRUNCATE_CHARS}),+ substring(input_state, 1, ${FIELD_TRUNCATE_CHARS}),event = '$ai_trace'- AND length(toString(properties.$ai_input_state)) > 0+ AND length(input_state) > 0) AS first_input,anyIf(- substring(toString(properties.$ai_output_state), 1, ${FIELD_TRUNCATE_CHARS}),+ substring(output_state, 1, ${FIELD_TRUNCATE_CHARS}),event = '$ai_trace'- AND length(toString(properties.$ai_output_state)) > 0+ AND length(output_state) > 0) AS last_output,argMinIf(- substring(toString(properties.$ai_input), 1, ${FIELD_TRUNCATE_CHARS}),+ substring(input, 1, ${FIELD_TRUNCATE_CHARS}),timestamp,event = '$ai_generation'- AND length(toString(properties.$ai_input)) > 0+ AND length(input) > 0) AS first_input_fallback,argMaxIf(- substring(toString(properties.$ai_output_choices), 1, ${FIELD_TRUNCATE_CHARS}),+ substring(output_choices, 1, ${FIELD_TRUNCATE_CHARS}),timestamp,event = '$ai_generation'- AND length(toString(properties.$ai_output_choices)) > 0+ AND length(output_choices) > 0) AS last_output_fallback- FROM events+ FROM posthog.ai_events AS ai_eventsWHERE event IN ('$ai_trace', '$ai_generation')AND timestamp >= toDateTime('${fromStr}', 'UTC')AND timestamp <= toDateTime('${toStr}', 'UTC')- AND properties.$ai_trace_id IN (${idList})+ AND trace_id IN (${idList})GROUP BY trace_id`,}