Skip to content

components/dust: update wording + add skipToolsvalidation #16659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@ import { TIMEZONE_OPTIONS } from "../../common/constants.mjs";
import dust from "../../dust.app.mjs";

export default {
key: "dust-talk-assistant",
name: "Talk to Assistant",
description: "Send a message to an assistant on Dust and receive an answer. [See the documentation](https://docs.dust.tt/reference/post_api-v1-w-wid-assistant-conversations-cid-messages)",
version: "0.0.1",
key: "dust-run-agent",
name: "Run an Agent",
description:
"Send a message to an agent on Dust and receive an answer. [See the documentation](https://docs.dust.tt/reference/post_api-v1-w-wid-assistant-conversations-cid-messages)",
version: "0.0.2",
type: "action",
props: {
dust,
assistantId: {
propDefinition: [
dust,
"assistantId",
],
agentId: {
propDefinition: [dust, "agentId"],
},
content: {
type: "string",
label: "Message Content",
description: "The content of the message to be sent to the assistant",
description: "The content of the message to be sent to the agent",
},
timezone: {
type: "string",
Expand All @@ -36,11 +34,16 @@ export default {
label: "Email",
description: "Put an email if needed.",
},
skipToolsValidation: {
type: "boolean",
label: "Skip Tools Validation",
default: false,
description:
"Skip all tools validation. All tools will be run by the agent without user validation.",
},
},
async run({ $ }) {
const {
conversation, message,
} = await this.dust.sendMessageToAssistant({
const { conversation, message } = await this.dust.sendMessageToAgent({
$,
data: {
message: {
Expand All @@ -54,17 +57,18 @@ export default {
},
mentions: [
{
configurationId: this.assistantId,
configurationId: this.agentId,
},
],
},
blocking: true,
skipToolsValidation: this.skipToolsValidation,
visibility: "unlisted",
title: null,
},
});

$.export("$summary", "Successfully sent message to assistant");
$.export("$summary", "Successfully sent message to agent");
return {
agentMessage: conversation.content[1][0].content,
conversationUrl: `https://dust.tt/w/${conversation.owner.sId}/assistant/${conversation.sId}`,
Expand Down
29 changes: 11 additions & 18 deletions components/dust/dust.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ export default {
type: "app",
app: "dust",
propDefinitions: {
assistantId: {
agentId: {
type: "string",
label: "Assistant ID",
description: "Select the name of your Assistant from the list. Your Dust Assistant must be a **Shared** or **Company** Assistant. Personal Assistants are not visible in this list.",
label: "Agent ID",
description:
"Select the name of your Agent from the list. Non **Published** agents are not visible in this list.",
async options() {
const { agentConfigurations } = await this.listAssistants();
const { agentConfigurations } = await this.listAgents();

return agentConfigurations.map(({
description, name, sId: value,
}) => ({
return agentConfigurations.map(({ description, name, sId: value }) => ({
label: `${name} - ${description}`,
value,
}));
Expand All @@ -26,9 +25,7 @@ export default {
async options() {
const { data_sources: ds } = await this.listDataSources();

return ds.map(({
description, name, dustAPIDataSourceId: value,
}) => ({
return ds.map(({ description, name, dustAPIDataSourceId: value }) => ({
label: `${name} - ${description}`,
value,
}));
Expand All @@ -44,16 +41,14 @@ export default {
Authorization: `Bearer ${this.$auth.api_key}`,
};
},
_makeRequest({
$ = this, path, ...opts
}) {
_makeRequest({ $ = this, path, ...opts }) {
return axios($, {
url: this._baseUrl() + path,
headers: this._headers(),
...opts,
});
},
listAssistants(opts = {}) {
listAgents(opts = {}) {
return this._makeRequest({
path: "/assistant/agent_configurations",
...opts,
Expand All @@ -65,16 +60,14 @@ export default {
...opts,
});
},
sendMessageToAssistant(opts = {}) {
sendMessageToAgent(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/assistant/conversations",
...opts,
});
},
upsertDocument({
documentId, dataSourceId, ...opts
}) {
upsertDocument({ documentId, dataSourceId, ...opts }) {
return this._makeRequest({
method: "POST",
path: `/data_sources/${dataSourceId}/documents/${documentId}`,
Expand Down
2 changes: 1 addition & 1 deletion components/dust/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/dust",
"version": "0.1.0",
"version": "0.1.1",
"description": "Pipedream Dust Components",
"main": "dust.app.mjs",
"keywords": [
Expand Down