Skip to content

Commit

Permalink
Add search label tool for include/process
Browse files Browse the repository at this point in the history
  • Loading branch information
flvndvd committed Mar 6, 2025
1 parent 31ca9df commit 6470127
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion front/lib/api/assistant/actions/process.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {
ActionConfigurationType,
AgentActionSpecification,
FunctionCallType,
FunctionMessageTypeModel,
Expand All @@ -23,7 +24,10 @@ import {
import _ from "lodash";

import { runActionStreamed } from "@app/lib/actions/server";
import { DEFAULT_PROCESS_ACTION_NAME } from "@app/lib/api/assistant/actions/constants";
import {
DEFAULT_PROCESS_ACTION_NAME,
DEFAULT_SEARCH_LABELS_ACTION_NAME,
} from "@app/lib/api/assistant/actions/constants";
import {
applyDataSourceFilters,
parseTimeFrame,
Expand All @@ -39,6 +43,7 @@ import type { Authenticator } from "@app/lib/auth";
import { AgentProcessAction } from "@app/lib/models/assistant/actions/process";
import { cloneBaseConfig, getDustProdAction } from "@app/lib/registry";
import { DataSourceViewResource } from "@app/lib/resources/data_source_view_resource";
import { generateRandomModelSId } from "@app/lib/resources/string_ids";
import logger from "@app/logger/logger";

interface ProcessActionBlob {
Expand Down Expand Up @@ -144,6 +149,30 @@ export class ProcessConfigurationServerRunner extends BaseActionConfigurationSer
return new Ok(spec);
}

getSupportingActions(): ActionConfigurationType[] {
const hasAutoTags = this.actionConfiguration.dataSources.some(
(ds) => ds.filter.tags?.mode === "auto"
);

if (hasAutoTags) {
return [
{
id: -1,
sId: generateRandomModelSId(),
type: "search_labels_configuration",
// Tool name must be unique. We use the parent tool name to make it unique.
name: `${DEFAULT_SEARCH_LABELS_ACTION_NAME}_${this.actionConfiguration.name}`,
dataSourceViewIds: this.actionConfiguration.dataSources.map(
(ds) => ds.dataSourceViewId
),
parentTool: this.actionConfiguration.name,
},
];
}

return [];
}

// This method is in charge of running the retrieval and creating an AgentProcessAction object in
// the database. It does not create any generic model related to the conversation. It is possible
// for an AgentProcessAction to be stored (once the query params are infered) but for its execution
Expand Down

0 comments on commit 6470127

Please sign in to comment.