🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(automations): filter prompt events by tags (#17727)
tobi_kl374f6a80e7b9
diff --git a/packages/shared/src/tableDefinitions/promptsTable.ts b/packages/shared/src/tableDefinitions/promptsTable.tsindex a2f1801605..2793c3e54c 100644--- a/packages/shared/src/tableDefinitions/promptsTable.ts+++ b/packages/shared/src/tableDefinitions/promptsTable.ts@@ -82,9 +82,9 @@ export function promptsTableColsWithOptions(}export function webhookActionFilterOptions(- labels: SingleValueOption[] = [],+ options?: PromptOptions,): ColumnDefinition[] {- return promptsTableColsWithOptions({ labels, tags: [] }).filter((col) =>- ["name", "labels"].includes(col.id),+ return promptsTableColsWithOptions(options).filter((col) =>+ ["name", "labels", "tags"].includes(col.id),);}diff --git a/web/src/features/automations/components/automationForm.clienttest.tsx b/web/src/features/automations/components/automationForm.clienttest.tsxindex fdec59abb8..44f76da172 100644--- a/web/src/features/automations/components/automationForm.clienttest.tsx+++ b/web/src/features/automations/components/automationForm.clienttest.tsx@@ -27,7 +27,9 @@ vi.mock("@/src/utils/api", () => ({},// Pulled in by the prompt-source filter builder.prompts: {- allLabels: { useQuery: () => ({ data: [], isFetching: false }) },+ filterOptions: {+ useQuery: () => ({ data: { labels: [], tags: [] }, isFetching: false }),+ },},projects: { byId: { useQuery: () => ({ data: undefined }) } },naturalLanguageFilters: {diff --git a/web/src/features/automations/components/automationForm.tsx b/web/src/features/automations/components/automationForm.tsxindex 6571584252..36017e9125 100644--- a/web/src/features/automations/components/automationForm.tsx+++ b/web/src/features/automations/components/automationForm.tsx@@ -275,9 +275,12 @@ const PromptTriggerFields = ({control: Control<FormValues>;disabled: boolean;}) => {- const [labelsOpened, setLabelsOpened] = React.useState(false);- const { data: labels = [], isFetching: labelsLoading } =- api.prompts.allLabels.useQuery({ projectId }, { enabled: labelsOpened });+ const [optionsOpened, setOptionsOpened] = React.useState(false);+ const { data: filterOptions, isFetching: optionsLoading } =+ api.prompts.filterOptions.useQuery(+ { projectId },+ { enabled: optionsOpened },+ );return (<>@@ -328,14 +331,12 @@ const PromptTriggerFields = ({<FormLabel>Filter</FormLabel><FormControl><InlineFilterBuilder- columns={webhookActionFilterOptions(- labels.map((value) => ({ value })),- )}- columnsWithCustomSelect={["labels"]}- loadingOptionColumns={labelsLoading ? ["labels"] : []}+ columns={webhookActionFilterOptions(filterOptions)}+ columnsWithCustomSelect={["labels", "tags"]}+ loadingOptionColumns={optionsLoading ? ["labels", "tags"] : []}onOptionsOpen={(columnId) => {- if (columnId === "labels") {- setLabelsOpened(true);+ if (columnId === "labels" || columnId === "tags") {+ setOptionsOpened(true);}}}filterState={field.value || []}diff --git a/worker/src/features/entityChange/promptVersionProcessor.ts b/worker/src/features/entityChange/promptVersionProcessor.tsindex 6fd1fc1b31..45436697e4 100644--- a/worker/src/features/entityChange/promptVersionProcessor.ts+++ b/worker/src/features/entityChange/promptVersionProcessor.ts@@ -54,6 +54,7 @@ export const promptVersionProcessor = async ({Name: event.prompt.name,Labels: event.prompt.labels,+ Tags: event.prompt.tags,action: event.action,},trigger,