Skip to content
Merged
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
105 changes: 105 additions & 0 deletions components/griptape/actions/create-assistant/create-assistant.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import app from "../../griptape.app.mjs";

export default {
key: "griptape-create-assistant",
name: "Create Assistant",
description: "Creates a new assistant in Griptape. [See the documentation](https://docs.griptape.ai/stable/griptape-cloud/api/api-reference/#/Assistants/CreateAssistant)",
version: "0.0.1",
type: "action",
props: {
app,
name: {
propDefinition: [
app,
"name",
],
},
description: {
propDefinition: [
app,
"description",
],
},
input: {
propDefinition: [
app,
"input",
],
},
knowledgeBaseIds: {
type: "string[]",
label: "Knowledge Base IDs",
description: "The knowledge base IDs of the assistant",
optional: true,
propDefinition: [
app,
"knowledgeBaseId",
],
},
rulesetIds: {
type: "string[]",
label: "Ruleset IDs",
description: "The ruleset IDs of the assistant",
optional: true,
propDefinition: [
app,
"rulesetId",
],
},
structureIds: {
type: "string[]",
label: "Structure IDs",
description: "The structure IDs of the assistant",
optional: true,
propDefinition: [
app,
"structureId",
],
},
toolIds: {
type: "string[]",
label: "Tool IDs",
description: "The tool IDs of the assistant",
optional: true,
propDefinition: [
app,
"toolId",
],
},
},
methods: {
createAssistant(args = {}) {
return this.app.post({
path: "/assistants",
...args,
});
},
},
async run({ $ }) {
const {
createAssistant,
name,
description,
input,
knowledgeBaseIds,
rulesetIds,
structureIds,
toolIds,
} = this;

const response = await createAssistant({
$,
data: {
name,
description,
input,
knowledge_base_ids: knowledgeBaseIds,
ruleset_ids: rulesetIds,
structure_ids: structureIds,
tool_ids: toolIds,
},
});
$.export("$summary", `Successfully created a new assistant with ID \`${response.assistant_id}\`.`);
return response;
},
};
43 changes: 43 additions & 0 deletions components/griptape/actions/delete-assistant/delete-assistant.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import app from "../../griptape.app.mjs";

export default {
key: "griptape-delete-assistant",
name: "Delete Assistant",
description: "Deletes an existing assistant. [See the documentation](https://docs.griptape.ai/stable/griptape-cloud/api/api-reference/#/Assistants/DeleteAssistant).",
version: "0.0.1",
type: "action",
props: {
app,
assistantId: {
propDefinition: [
app,
"assistantId",
],
},
},
methods: {
deleteAssistant({
assistantId, ...args
} = {}) {
return this.app.delete({
path: `/assistants/${assistantId}`,
...args,
});
},
},
async run({ $ }) {
const {
deleteAssistant,
assistantId,
} = this;

await deleteAssistant({
$,
assistantId,
});
$.export("$summary", "Successfully deleted assistant");
return {
success: true,
};
},
};
117 changes: 117 additions & 0 deletions components/griptape/actions/update-assistant/update-assistant.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import app from "../../griptape.app.mjs";

export default {
key: "griptape-update-assistant",
name: "Update Assistant",
description: "Updates an existing assistant. [See the documentation](https://docs.griptape.ai/stable/griptape-cloud/api/api-reference/#/Assistants/UpdateAssistant).",
version: "0.0.1",
type: "action",
props: {
app,
assistantId: {
propDefinition: [
app,
"assistantId",
],
},
name: {
optional: true,
propDefinition: [
app,
"name",
],
},
description: {
propDefinition: [
app,
"description",
],
},
input: {
optional: true,
propDefinition: [
app,
"input",
],
},
knowledgeBaseIds: {
type: "string[]",
label: "Knowledge Base IDs",
description: "The knowledge base IDs of the assistant",
optional: true,
propDefinition: [
app,
"knowledgeBaseId",
],
},
rulesetIds: {
type: "string[]",
label: "Ruleset IDs",
description: "The ruleset IDs of the assistant",
optional: true,
propDefinition: [
app,
"rulesetId",
],
},
structureIds: {
type: "string[]",
label: "Structure IDs",
description: "The structure IDs of the assistant",
optional: true,
propDefinition: [
app,
"structureId",
],
},
toolIds: {
type: "string[]",
label: "Tool IDs",
description: "The tool IDs of the assistant",
optional: true,
propDefinition: [
app,
"toolId",
],
},
},
methods: {
updateAssistant({
assistantId, ...args
} = {}) {
return this.app.patch({
path: `/assistants/${assistantId}`,
...args,
});
},
},
async run({ $ }) {
const {
updateAssistant,
assistantId,
name,
description,
input,
knowledgeBaseIds,
rulesetIds,
structureIds,
toolIds,
} = this;

const response = await updateAssistant({
$,
assistantId,
data: {
name,
description,
input,
knowledge_base_ids: knowledgeBaseIds,
ruleset_ids: rulesetIds,
structure_ids: structureIds,
tool_ids: toolIds,
},
});
$.export("$summary", `Successfully updated assistant with ID \`${response.assistant_id}\`.`);
return response;
},
};
Loading
Loading