Skip to content

Commit 39ea4be

Browse files
Mihir-MavalankarClaude Opus 4.6
andcommitted
ref(seer): Improve widget query hints for natural language agent
The Seer agent uses natural language tool calls, not raw API params. Replace hints that reference internal params (y_axes, group_by, query) with descriptions of what the widget visualizes and direct the agent to understand the intent from the query config. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
1 parent b0d2abe commit 39ea4be

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

static/app/views/dashboards/dashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function DashboardInner({
129129
// Push dashboard metadata into the LLM context tree for Seer Explorer.
130130
useLLMContext({
131131
contextHint:
132-
'This is a Sentry dashboard. The dateRange, environments, and projects below are global page filters that scope every widget query. Each child widget node contains its own query config that can be used with the telemetry_live_search tool to fetch or drill into its data.',
132+
'This is a Sentry dashboard. The dateRange, environments, and projects below are global page filters that scope every widget query. Each child widget node contains its own query config that can be used with tools like telemetry_live_search and telemetry_index_list_nodes to fetch data for that widget and dig deeper. Based on the user question, data might be needed from multiple widgets.',
133133
title: dashboard.title,
134134
widgetCount: dashboard.widgets.length,
135135
filters: dashboard.filters,

static/app/views/dashboards/widgetCard/widgetLLMContext.spec.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ import {getWidgetQueryLLMHint, readableConditions} from './widgetLLMContext';
44

55
describe('getWidgetQueryLLMHint', () => {
66
it.each([
7-
[DisplayType.LINE, 'timeseries'],
8-
[DisplayType.AREA, 'timeseries'],
9-
[DisplayType.BAR, 'timeseries'],
7+
[DisplayType.LINE, 'timeseries chart'],
8+
[DisplayType.AREA, 'timeseries chart'],
9+
[DisplayType.BAR, 'timeseries chart'],
1010
])('returns timeseries hint for %s', (displayType, expected) => {
1111
expect(getWidgetQueryLLMHint(displayType)).toContain(expected);
1212
});
1313

1414
it('returns table hint for TABLE', () => {
15-
expect(getWidgetQueryLLMHint(DisplayType.TABLE)).toContain('table query');
15+
expect(getWidgetQueryLLMHint(DisplayType.TABLE)).toContain('shows a table');
1616
});
1717

18-
it('returns single aggregate hint for BIG_NUMBER', () => {
19-
expect(getWidgetQueryLLMHint(DisplayType.BIG_NUMBER)).toContain('single aggregate');
18+
it('returns single number hint for BIG_NUMBER', () => {
19+
expect(getWidgetQueryLLMHint(DisplayType.BIG_NUMBER)).toContain('single number');
2020
expect(getWidgetQueryLLMHint(DisplayType.BIG_NUMBER)).toContain(
21-
'value is included below'
21+
'current value is included below'
2222
);
2323
});
2424

25-
it('returns table hint as default for unknown types', () => {
26-
expect(getWidgetQueryLLMHint(DisplayType.WHEEL)).toContain('table query');
25+
it('returns generic hint for unknown types', () => {
26+
expect(getWidgetQueryLLMHint(DisplayType.WHEEL)).toContain('shows data');
2727
});
2828
});
2929

static/app/views/dashboards/widgetCard/widgetLLMContext.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ export function readableConditions(query: string): string {
1818
}
1919

2020
/**
21-
* Returns a hint for the Seer Explorer agent describing how to re-query this
22-
* widget's data using a tool call, if the user wants to dig deeper.
21+
* Returns a hint for the Seer Explorer agent describing what this widget
22+
* visualizes so it can understand the intent from the query config.
2323
*/
2424
export function getWidgetQueryLLMHint(displayType: DisplayType): string {
2525
switch (displayType) {
2626
case DisplayType.LINE:
2727
case DisplayType.AREA:
2828
case DisplayType.BAR:
29-
return 'To dig deeper into this widget, run a timeseries query using y_axes (aggregates) + group_by (columns) + query (conditions)';
29+
return 'This widget shows a timeseries chart. The aggregates are the y-axis metrics, columns are the group-by breakdowns, and conditions filter the data. Understand the intent from the query config below.';
3030
case DisplayType.TABLE:
31-
return 'To dig deeper into this widget, run a table query using fields (aggregates + columns) + query (conditions) + sort (orderby)';
31+
return 'This widget shows a table. The aggregates and columns define the visible fields, orderby is the sort, and conditions filter the data. Understand the intent from the query config below.';
3232
case DisplayType.BIG_NUMBER:
33-
return 'To dig deeper into this widget, run a single aggregate query using fields (aggregates) + query (conditions); current value is included below';
33+
return 'This widget shows a single number. The aggregate is the metric, conditions filter the data, and the current value is included below. Understand the intent from the query config below.';
3434
default:
35-
return 'To dig deeper into this widget, run a table query using fields (aggregates + columns) + query (conditions)';
35+
return 'This widget shows data. The aggregates, columns, and conditions define what is displayed. Understand the intent from the query config below.';
3636
}
3737
}

0 commit comments

Comments
 (0)