-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Utopian Labs new components #16812
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
Utopian Labs new components #16812
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c190262
package/pnpm
GTFalcao e79e0ed
app/package base
GTFalcao 3f56c91
Get Run Status action
GTFalcao d31193e
Initiate Research Run + utils
GTFalcao 06428f6
pnpm
GTFalcao d067bec
Adjustments
GTFalcao 335ac53
Initiate Qualification Run + reusing props
GTFalcao 861dfc5
Classification and Timing runs
GTFalcao 0cbf137
Initiate Copywriting Run
GTFalcao 6579708
eslint run
GTFalcao 8465db4
summary improvements
GTFalcao 4503fcc
Adjusting incorrect language codes
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
22 changes: 22 additions & 0 deletions
22
components/utopian_labs/actions/get-run-status/get-run-status.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,22 @@ | ||
import utopianLabs from "../../utopian_labs.app.mjs"; | ||
|
||
export default { | ||
key: "utopian_labs-get-run-status", | ||
name: "Get Run Status", | ||
description: "Retrieve the status of an initiated run. [See the documentation](https://docs.utopianlabs.ai/research#retrieve-research-run-status)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
utopianLabs, | ||
runId: { | ||
type: "string", | ||
label: "Run ID", | ||
description: "The ID of the run you want to retrieve the status for", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.utopianLabs.getRunStatus(this.runId); | ||
$.export("$summary", `Successfully retrieved status for run ${this.runId}`); | ||
return response; | ||
}, | ||
}; |
82 changes: 82 additions & 0 deletions
82
components/utopian_labs/actions/initiate-classification-run/initiate-classification-run.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,82 @@ | ||
import { | ||
parseArrayAsJSON, | ||
parseObjectEntries, parseStringAsJSON, | ||
} from "../../common/utils.mjs"; | ||
import utopianLabs from "../../utopian_labs.app.mjs"; | ||
|
||
export default { | ||
key: "utopian_labs-initiate-classification-run", | ||
name: "Initiate Classification Run", | ||
description: "Initiate a classification run of the R1-Classification agent. [See the documentation](https://docs.utopianlabs.ai/classification#initiate-a-classification-run)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
utopianLabs, | ||
agent: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"agent", | ||
], | ||
options: [ | ||
{ | ||
label: "r1-classification - the default research agent, which has access to a larger set of research sources", | ||
value: "r1-classification", | ||
}, | ||
{ | ||
label: "r1-classification-light - the light research agent, more affordable", | ||
value: "r1-classification-light", | ||
}, | ||
], | ||
}, | ||
lead: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"lead", | ||
], | ||
description: "The lead to determine the classification for. [See the documentation](https://docs.utopianlabs.ai/types#the-lead-type) for more information. Example: `{ \"company\": { \"website\": \"https://pipedream.com/\" } }`", | ||
}, | ||
options: { | ||
type: "string[]", | ||
label: "Options", | ||
description: "The options to classify the lead into (minimum 2, maximum 10). Each option should be an object such as: `{ \"name\": \"option name\", \"description\": \"option description\" }`", | ||
}, | ||
minResearchSteps: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"minResearchSteps", | ||
], | ||
}, | ||
maxResearchSteps: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"maxResearchSteps", | ||
], | ||
}, | ||
context: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"context", | ||
], | ||
}, | ||
additionalOptions: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"additionalOptions", | ||
], | ||
description: "Additional parameters to send in the request. [See the documentation](https://docs.utopianlabs.ai/classification#initiate-a-classification-run) for all available parameters. Values will be parsed as JSON where applicable.", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.utopianLabs.initiateRun({ | ||
agent: this.agent, | ||
lead: parseStringAsJSON(this.lead), | ||
options: parseArrayAsJSON(this.options), | ||
min_research_steps: this.minResearchSteps, | ||
max_research_steps: this.maxResearchSteps, | ||
context: this.context, | ||
...parseObjectEntries(this.additionalOptions), | ||
}); | ||
$.export("$summary", `Successfully initiated run (ID: ${response.id}`); | ||
return response; | ||
}, | ||
}; |
84 changes: 84 additions & 0 deletions
84
components/utopian_labs/actions/initiate-copywriting-run/initiate-copywriting-run.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,84 @@ | ||
import { LANGUAGE_CODE_OPTIONS } from "../../common/constants.mjs"; | ||
import { | ||
parseObjectEntries, parseStringAsJSON, | ||
} from "../../common/utils.mjs"; | ||
import utopianLabs from "../../utopian_labs.app.mjs"; | ||
|
||
export default { | ||
key: "utopian_labs-initiate-copywriting-run", | ||
name: "Initiate Copywriting Run", | ||
description: "Initiate a copywriting run of the R1-Copywriting agent. [See the documentation](https://docs.utopianlabs.ai/copywriting#initiate-a-copywriting-run)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
utopianLabs, | ||
agent: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"agent", | ||
], | ||
options: [ | ||
{ | ||
label: "r1-copywriting - the default research agent, which has access to a larger set of research sources", | ||
value: "r1-copywriting", | ||
}, | ||
{ | ||
label: "r1-copywriting-light - the light research agent, more affordable", | ||
value: "r1-copywriting-light", | ||
}, | ||
], | ||
}, | ||
lead: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"lead", | ||
], | ||
description: "The lead to write a sales message for. [See the documentation](https://docs.utopianlabs.ai/types#the-lead-type) for more information. Example: `{ \"company\": { \"website\": \"https://pipedream.com/\" } }`", | ||
}, | ||
language: { | ||
type: "string", | ||
label: "Language", | ||
description: "The langauge to write the copy in (defaults to `en-US`)", | ||
optional: true, | ||
options: LANGUAGE_CODE_OPTIONS, | ||
}, | ||
minResearchSteps: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"minResearchSteps", | ||
], | ||
}, | ||
maxResearchSteps: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"maxResearchSteps", | ||
], | ||
}, | ||
context: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"context", | ||
], | ||
}, | ||
additionalOptions: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"additionalOptions", | ||
], | ||
description: "Additional parameters to send in the request. [See the documentation](https://docs.utopianlabs.ai/copywriting#initiate-a-copywriting-run) for all available parameters. Values will be parsed as JSON where applicable.", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.utopianLabs.initiateRun({ | ||
agent: this.agent, | ||
lead: parseStringAsJSON(this.lead), | ||
language: this.language, | ||
min_research_steps: this.minResearchSteps, | ||
max_research_steps: this.maxResearchSteps, | ||
context: this.context, | ||
...parseObjectEntries(this.additionalOptions), | ||
}); | ||
$.export("$summary", `Successfully initiated run (ID: ${response.id}`); | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return response; | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; |
75 changes: 75 additions & 0 deletions
75
components/utopian_labs/actions/initiate-qualification-run/initiate-qualification-run.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,75 @@ | ||
import { | ||
parseObjectEntries, parseStringAsJSON, | ||
} from "../../common/utils.mjs"; | ||
import utopianLabs from "../../utopian_labs.app.mjs"; | ||
|
||
export default { | ||
key: "utopian_labs-initiate-qualification-run", | ||
name: "Initiate Qualification Run", | ||
description: "Initiate a qualification run of the R1-Qualification agent. [See the documentation](https://docs.utopianlabs.ai/qualification#initiate-a-qualification-run)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
utopianLabs, | ||
agent: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"agent", | ||
], | ||
options: [ | ||
{ | ||
label: "r1-qualification - the default research agent, which has access to a larger set of research sources", | ||
value: "r1-qualification", | ||
}, | ||
{ | ||
label: "r1-qualification-light - the light research agent, more affordable", | ||
value: "r1-qualification-light", | ||
}, | ||
], | ||
}, | ||
lead: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"lead", | ||
], | ||
description: "The lead to qualify. [See the documentation](https://docs.utopianlabs.ai/types#the-lead-type) for more information. Example: `{ \"company\": { \"website\": \"https://pipedream.com/\" } }`", | ||
}, | ||
minResearchSteps: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"minResearchSteps", | ||
], | ||
}, | ||
maxResearchSteps: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"maxResearchSteps", | ||
], | ||
}, | ||
context: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"context", | ||
], | ||
}, | ||
additionalOptions: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"additionalOptions", | ||
], | ||
description: "Additional parameters to send in the request. [See the documentation](https://docs.utopianlabs.ai/qualification#initiate-a-qualification-run) for all available parameters. Values will be parsed as JSON where applicable.", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.utopianLabs.initiateRun({ | ||
agent: this.agent, | ||
lead: parseStringAsJSON(this.lead), | ||
min_research_steps: this.minResearchSteps, | ||
max_research_steps: this.maxResearchSteps, | ||
context: this.context, | ||
...parseObjectEntries(this.additionalOptions), | ||
}); | ||
$.export("$summary", `Successfully initiated run (ID: ${response.id}`); | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return response; | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; |
73 changes: 73 additions & 0 deletions
73
components/utopian_labs/actions/initiate-research-run/initiate-research-run.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,73 @@ | ||
import { | ||
parseObjectEntries, parseStringAsJSON, | ||
} from "../../common/utils.mjs"; | ||
import utopianLabs from "../../utopian_labs.app.mjs"; | ||
|
||
export default { | ||
key: "utopian_labs-initiate-research-run", | ||
name: "Initiate Research Run", | ||
description: "Initiate a research run of the R1 agent. [See the documentation](https://docs.utopianlabs.ai/research#initiate-a-research-run)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
utopianLabs, | ||
agent: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"agent", | ||
], | ||
options: [ | ||
{ | ||
label: "r1 - a more powerful agent that has access to a larger set of research sources", | ||
value: "r1", | ||
}, | ||
{ | ||
label: "r1-light - a more affordable version of R1", | ||
value: "r1-light", | ||
}, | ||
], | ||
}, | ||
lead: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"lead", | ||
], | ||
}, | ||
minResearchSteps: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"minResearchSteps", | ||
], | ||
}, | ||
maxResearchSteps: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"maxResearchSteps", | ||
], | ||
}, | ||
context: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"context", | ||
], | ||
}, | ||
additionalOptions: { | ||
propDefinition: [ | ||
utopianLabs, | ||
"additionalOptions", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.utopianLabs.initiateRun({ | ||
agent: this.agent, | ||
lead: parseStringAsJSON(this.lead), | ||
min_research_steps: this.minResearchSteps, | ||
max_research_steps: this.maxResearchSteps, | ||
context: this.context, | ||
...parseObjectEntries(this.additionalOptions), | ||
}); | ||
$.export("$summary", `Successfully initiated run (ID: ${response.id}`); | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return response; | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; |
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.