-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
887f916
Initial AI-generated code + ESLint fixes
GTFalcao cb876f7
Merge branch 'master' into issue-14283
GTFalcao 11c0028
Package/app updates
GTFalcao d3c73f9
pnpm
GTFalcao e6ca146
App adjustments and Search Templates action
GTFalcao 0d337d5
Execute Agent action + lots of improvements
GTFalcao 975a341
Get Execution Response action
GTFalcao 9b001e8
Removing 'find template details'
GTFalcao 1d8c933
Component name fix
GTFalcao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
components/tess_ai_by_pareto/actions/execute-agent/execute-agent.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}, | ||
}; |
30 changes: 30 additions & 0 deletions
30
components/tess_ai_by_pareto/actions/get-execution-response/get-execution-response.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}, | ||
}; |
47 changes: 47 additions & 0 deletions
47
components/tess_ai_by_pareto/actions/search-ai-agents/search-ai-agents.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-ai-agents", | ||
name: "Search AI Agents", | ||
description: | ||
"Retrieve AI Agents (templates) that match the specified criteria. [See the documentation](https://tess.pareto.io/api/swagger#/default/201046139d07458d530ad3526e0b3c2f)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
query: { | ||
type: "string", | ||
label: "Search Query", | ||
description: | ||
"Search agents (templates) by title, description and long description.", | ||
optional: true, | ||
}, | ||
type: { | ||
type: "string", | ||
label: "Type Filter", | ||
description: "Filter by template type", | ||
optional: true, | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
maxResults: { | ||
type: "integer", | ||
label: "Max Results", | ||
description: "The maximum number of results to return", | ||
optional: true, | ||
default: 15, | ||
min: 1, | ||
max: 1000, | ||
}, | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
async run({ $ }) { | ||
const response = await this.app.searchTemplates({ | ||
$, | ||
params: { | ||
q: this.query, | ||
type: this.type, | ||
per_page: this.maxResults, | ||
}, | ||
}); | ||
$.export("$summary", `Retrieved ${response.data?.length} templates`); | ||
return response; | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@pipedream/tess_ai_by_pareto", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Pipedream Tess AI by Pareto Components", | ||
"main": "tess_ai_by_pareto.app.mjs", | ||
"keywords": [ | ||
|
@@ -11,5 +11,8 @@ | |
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@pipedream/platform": "^3.0.3" | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.