You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.ai-filter.tsx
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ import { findProjectBySlug } from "~/models/project.server";
description: "Look up available tags in the environment",
57
+
parameters: z.object({
58
+
query: z.string().optional().describe("Optional search query to filter tags"),
59
+
}),
60
+
execute: async({ query })=>{
61
+
consttags=awaittagPresenter.call({
62
+
projectId: environment.projectId,
63
+
name: query,
64
+
page: 1,
65
+
pageSize: 50,
66
+
});
67
+
return{
68
+
tags: tags.tags.map((tag)=>tag.name),
69
+
total: tags.tags.length,
70
+
};
71
+
},
72
+
},
73
+
lookupVersions: {
74
+
description:
75
+
"Look up available versions in the environment. If you specify `isCurrent` it will return a single version string if it finds one. Otherwise it will return an array of version strings.",
76
+
parameters: z.object({
77
+
isCurrent: z.boolean().optional().describe("If true, only return the current version"),
78
+
versionPrefix: z
79
+
.string()
80
+
.optional()
81
+
.describe(
82
+
"Optional version name to filter (e.g. 20250701.1), it uses contains to compare. Don't pass `latest` or `current`, the query has to be in the reverse date format specified. Leave out to get all recent versions."
"Look up available tasks in the environment. It will return each one. The `slug` is used for the filtering. You also get the triggerSource which is either `STANDARD` or `SCHEDULED`",
prompt: `You are an AI assistant that converts natural language descriptions into structured filter parameters for a task run filtering system.
44
147
45
148
Available filter options:
46
149
- statuses: Array of run statuses (PENDING, EXECUTING, COMPLETED_SUCCESSFULLY, COMPLETED_WITH_ERRORS, CANCELED, TIMED_OUT, CRASHED, etc.)
47
150
- period: Time period string (e.g., "1h", "7d", "30d", "1y")
48
151
- from/to: Unix ms timestamps for specific time ranges. You'll need to use a converter if they give you a date. Today's date is ${newDate().toISOString()}, if they only specify a day use the current month. If they don't specify a year use the current year. If they don't specify a time of day use midnight to midnight.
49
-
- tags: Array of tag names to filter by
50
-
- tasks: Array of task identifiers to filter by
152
+
- tags: Array of tag names to filter by. Use the lookupTags tool to get the tags.
153
+
- tasks: Array of task identifiers to filter by. Use the lookupTasks tool to get the tasks.
- versions: Array of version identifiers to filter by
155
+
- queues: Array of queue names to filter by. Use the lookupQueues tool to get the queues.
156
+
- versions: Array of version identifiers to filter by. Use the lookupVersions tool to get the versions. The "latest" version will be the first returned. The "current" or "deployed" version will have isCurrent set to true.
54
157
- rootOnly: Boolean to show only root runs (not child runs)
55
158
- runId: Array of specific run IDs to filter by
56
159
- batchId: Specific batch ID to filter by
@@ -70,6 +173,8 @@ Common patterns to recognize:
70
173
- "using large machine" → machines: ["large-1x", "large-2x"]
71
174
- "root only" → rootOnly: true
72
175
176
+
Use the available tools to look up actual tags, versions, queues, and tasks in the environment when the user mentions them. This will help you provide accurate filter values.
177
+
73
178
Unless they specify they only want root runs, set rootOnly to false.
74
179
75
180
Convert the following natural language description into structured filters:
@@ -81,20 +186,17 @@ Return only the filters that are explicitly mentioned or can be reasonably infer
"Try being more specific about what you want to filter",
95
-
"Use common terms like 'failed runs', 'last 7 days', 'with tag X'",
96
-
"Check that your description is clear and unambiguous",
97
-
],
198
+
suggestions:
199
+
"Try being more specific about what you want to filter. Use common terms like 'failed runs', 'last 7 days', 'with tag X'. Check that your description is clear and unambiguous",
0 commit comments