-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Tess AI by Pareto new components #14381
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
Changes from 8 commits
887f916
cb876f7
11c0028
d3c73f9
e6ca146
0d337d5
975a341
9b001e8
1d8c933
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { getQuestionProps } from "../../common/utils.mjs"; | ||
| import app from "../../tess_ai_by_pareto.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "tess_ai_by_pareto-execute-agent", | ||
| name: "Execute AI Agent", | ||
| description: | ||
| "Executes an AI Agent (template) with the given input. [See the documentation](https://tess.pareto.io/api/swagger#/default/f13b3be7386ce63d99fa4bdee0cf6c95)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| templateId: { | ||
| propDefinition: [ | ||
| app, | ||
| "templateId", | ||
| ], | ||
| reloadProps: true, | ||
| }, | ||
| }, | ||
| methods: { | ||
| getQuestionProps, | ||
| }, | ||
| async additionalProps() { | ||
| const { questions } = await this.app.getTemplate(this.templateId); | ||
| return this.getQuestionProps(questions); | ||
|
|
||
| }, | ||
| async run({ $ }) { | ||
| /* eslint-disable no-unused-vars */ | ||
| const { | ||
| app, templateId, getQuestionProps, ...data | ||
| } = this; | ||
| const response = await this.app.executeTemplate({ | ||
| $, | ||
| templateId, | ||
| data, | ||
| }); | ||
| $.export( | ||
| "$summary", | ||
| `Executed AI agent ${response.id}`, | ||
| ); | ||
| return response; | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import app from "../../tess_ai_by_pareto.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "tess_ai_by_pareto-get-execution-response", | ||
| name: "Get Agent Execution Response", | ||
| description: | ||
| "Retrieves the result of a previously executed AI Agent (template). [See the documentation](https://tess.pareto.io/api/swagger#/default/370b6709c5d9e8c17a76e1abb288e7ad)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| executionId: { | ||
| type: "string", | ||
| label: "Agent Execution ID", | ||
| description: | ||
| "The ID of the AI Agent (template) execution to retrieve the result for.", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const result = await this.app.getTemplateResponse({ | ||
| $, | ||
| executionId: this.executionId, | ||
| }); | ||
| $.export( | ||
| "$summary", | ||
| `Retrieved response for execution ID ${this.executionId}`, | ||
| ); | ||
| return result; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,47 @@ | ||||||
| import app from "../../tess_ai_by_pareto.app.mjs"; | ||||||
|
|
||||||
| export default { | ||||||
| key: "tess_ai_by_pareto-search-templates", | ||||||
|
||||||
| key: "tess_ai_by_pareto-search-templates", | |
| key: "tess_ai_by_pareto-search-ai-agents", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align file path with action key for consistency.
The file is located in search-ai-agents directory but the action key uses search-templates. This inconsistency could cause confusion. Consider either:
- Renaming the directory to
search-templatesto match the action key, or - Updating the action key to
tess_ai_by_pareto-search-ai-agents
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| export function getQuestionProps(questions) { | ||
| function getQuestionPropType(type) { | ||
| switch (type) { | ||
| case "number": | ||
| return "integer"; | ||
| default: | ||
| return "string"; | ||
| } | ||
| } | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return (questions ?? []).reduce((obj, question) => { | ||
| obj[question.name] = { | ||
| type: getQuestionPropType(question.type), | ||
| label: `Field: "${question.name}"`, | ||
| description: `Type: \`${question.type}\`. Description: "${question.description}"`, | ||
| options: question.options, | ||
| optional: !question.required, | ||
| }; | ||
| return obj; | ||
| }, {}); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,73 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "tess_ai_by_pareto", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| templateId: { | ||
| type: "string", | ||
| label: "AI Agent ID", | ||
| description: "The ID of the AI Agent (template) to execute.", | ||
| useQuery: true, | ||
| async options({ | ||
| page = 0, query, | ||
| }) { | ||
| const response = await this.searchTemplates({ | ||
| params: { | ||
| page: page + 1, | ||
| q: query || undefined, | ||
| }, | ||
| }); | ||
| return response?.data?.map((template) => ({ | ||
| label: template.title, | ||
| value: template.id, | ||
| })); | ||
| }, | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return "https://tess.pareto.io/api"; | ||
| }, | ||
| async _makeRequest({ | ||
| $ = this, path = "/", headers, ...otherOpts | ||
| } = {}) { | ||
| return axios($, { | ||
| url: this._baseUrl() + path, | ||
| headers: { | ||
| ...headers, | ||
| "Authorization": `Bearer ${this.$auth.api_token}`, | ||
| }, | ||
| ...otherOpts, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| async executeTemplate({ | ||
| templateId, ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: `/templates/${templateId}/execute`, | ||
| ...args, | ||
| }); | ||
| }, | ||
| async getTemplate(templateId) { | ||
| return this._makeRequest({ | ||
| path: `/templates/${templateId}`, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| async searchTemplates(args) { | ||
| return this._makeRequest({ | ||
| path: "/templates", | ||
| ...args, | ||
| }); | ||
| }, | ||
| async getTemplateResponse({ | ||
| executionId, ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/template-responses/${executionId}`, | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.