Skip to content

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

Open
wants to merge 11 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
22 changes: 22 additions & 0 deletions components/utopian_labs/actions/get-run-status/get-run-status.mjs
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;
},
};
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;
},
};
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})`);
return response;
},
};
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})`);
return response;
},
};
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})`);
return response;
},
};
Loading
Loading