Skip to content

Commit 0d5fa2c

Browse files
authored
Utopian Labs new components (#16812)
* package/pnpm * app/package base * Get Run Status action * Initiate Research Run + utils * pnpm * Adjustments * Initiate Qualification Run + reusing props * Classification and Timing runs * Initiate Copywriting Run * eslint run * summary improvements * Adjusting incorrect language codes
1 parent e320141 commit 0d5fa2c

File tree

11 files changed

+705
-15
lines changed

11 files changed

+705
-15
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import utopianLabs from "../../utopian_labs.app.mjs";
2+
3+
export default {
4+
key: "utopian_labs-get-run-status",
5+
name: "Get Run Status",
6+
description: "Retrieve the status of an initiated run. [See the documentation](https://docs.utopianlabs.ai/research#retrieve-research-run-status)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
utopianLabs,
11+
runId: {
12+
type: "string",
13+
label: "Run ID",
14+
description: "The ID of the run you want to retrieve the status for",
15+
},
16+
},
17+
async run({ $ }) {
18+
const response = await this.utopianLabs.getRunStatus(this.runId);
19+
$.export("$summary", `Successfully retrieved status for run ${this.runId}`);
20+
return response;
21+
},
22+
};
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import {
2+
parseArrayAsJSON,
3+
parseObjectEntries, parseStringAsJSON,
4+
} from "../../common/utils.mjs";
5+
import utopianLabs from "../../utopian_labs.app.mjs";
6+
7+
export default {
8+
key: "utopian_labs-initiate-classification-run",
9+
name: "Initiate Classification Run",
10+
description: "Initiate a classification run of the R1-Classification agent. [See the documentation](https://docs.utopianlabs.ai/classification#initiate-a-classification-run)",
11+
version: "0.0.1",
12+
type: "action",
13+
props: {
14+
utopianLabs,
15+
agent: {
16+
propDefinition: [
17+
utopianLabs,
18+
"agent",
19+
],
20+
options: [
21+
{
22+
label: "r1-classification - the default research agent, which has access to a larger set of research sources",
23+
value: "r1-classification",
24+
},
25+
{
26+
label: "r1-classification-light - the light research agent, more affordable",
27+
value: "r1-classification-light",
28+
},
29+
],
30+
},
31+
lead: {
32+
propDefinition: [
33+
utopianLabs,
34+
"lead",
35+
],
36+
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/\" } }`",
37+
},
38+
options: {
39+
type: "string[]",
40+
label: "Options",
41+
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\" }`",
42+
},
43+
minResearchSteps: {
44+
propDefinition: [
45+
utopianLabs,
46+
"minResearchSteps",
47+
],
48+
},
49+
maxResearchSteps: {
50+
propDefinition: [
51+
utopianLabs,
52+
"maxResearchSteps",
53+
],
54+
},
55+
context: {
56+
propDefinition: [
57+
utopianLabs,
58+
"context",
59+
],
60+
},
61+
additionalOptions: {
62+
propDefinition: [
63+
utopianLabs,
64+
"additionalOptions",
65+
],
66+
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.",
67+
},
68+
},
69+
async run({ $ }) {
70+
const response = await this.utopianLabs.initiateRun({
71+
agent: this.agent,
72+
lead: parseStringAsJSON(this.lead),
73+
options: parseArrayAsJSON(this.options),
74+
min_research_steps: this.minResearchSteps,
75+
max_research_steps: this.maxResearchSteps,
76+
context: this.context,
77+
...parseObjectEntries(this.additionalOptions),
78+
});
79+
$.export("$summary", `Successfully initiated run (ID: ${response.id})`);
80+
return response;
81+
},
82+
};
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { LANGUAGE_CODE_OPTIONS } from "../../common/constants.mjs";
2+
import {
3+
parseObjectEntries, parseStringAsJSON,
4+
} from "../../common/utils.mjs";
5+
import utopianLabs from "../../utopian_labs.app.mjs";
6+
7+
export default {
8+
key: "utopian_labs-initiate-copywriting-run",
9+
name: "Initiate Copywriting Run",
10+
description: "Initiate a copywriting run of the R1-Copywriting agent. [See the documentation](https://docs.utopianlabs.ai/copywriting#initiate-a-copywriting-run)",
11+
version: "0.0.1",
12+
type: "action",
13+
props: {
14+
utopianLabs,
15+
agent: {
16+
propDefinition: [
17+
utopianLabs,
18+
"agent",
19+
],
20+
options: [
21+
{
22+
label: "r1-copywriting - the default research agent, which has access to a larger set of research sources",
23+
value: "r1-copywriting",
24+
},
25+
{
26+
label: "r1-copywriting-light - the light research agent, more affordable",
27+
value: "r1-copywriting-light",
28+
},
29+
],
30+
},
31+
lead: {
32+
propDefinition: [
33+
utopianLabs,
34+
"lead",
35+
],
36+
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/\" } }`",
37+
},
38+
language: {
39+
type: "string",
40+
label: "Language",
41+
description: "The langauge to write the copy in (defaults to `en-US`)",
42+
optional: true,
43+
options: LANGUAGE_CODE_OPTIONS,
44+
},
45+
minResearchSteps: {
46+
propDefinition: [
47+
utopianLabs,
48+
"minResearchSteps",
49+
],
50+
},
51+
maxResearchSteps: {
52+
propDefinition: [
53+
utopianLabs,
54+
"maxResearchSteps",
55+
],
56+
},
57+
context: {
58+
propDefinition: [
59+
utopianLabs,
60+
"context",
61+
],
62+
},
63+
additionalOptions: {
64+
propDefinition: [
65+
utopianLabs,
66+
"additionalOptions",
67+
],
68+
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.",
69+
},
70+
},
71+
async run({ $ }) {
72+
const response = await this.utopianLabs.initiateRun({
73+
agent: this.agent,
74+
lead: parseStringAsJSON(this.lead),
75+
language: this.language,
76+
min_research_steps: this.minResearchSteps,
77+
max_research_steps: this.maxResearchSteps,
78+
context: this.context,
79+
...parseObjectEntries(this.additionalOptions),
80+
});
81+
$.export("$summary", `Successfully initiated run (ID: ${response.id})`);
82+
return response;
83+
},
84+
};
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import {
2+
parseObjectEntries, parseStringAsJSON,
3+
} from "../../common/utils.mjs";
4+
import utopianLabs from "../../utopian_labs.app.mjs";
5+
6+
export default {
7+
key: "utopian_labs-initiate-qualification-run",
8+
name: "Initiate Qualification Run",
9+
description: "Initiate a qualification run of the R1-Qualification agent. [See the documentation](https://docs.utopianlabs.ai/qualification#initiate-a-qualification-run)",
10+
version: "0.0.1",
11+
type: "action",
12+
props: {
13+
utopianLabs,
14+
agent: {
15+
propDefinition: [
16+
utopianLabs,
17+
"agent",
18+
],
19+
options: [
20+
{
21+
label: "r1-qualification - the default research agent, which has access to a larger set of research sources",
22+
value: "r1-qualification",
23+
},
24+
{
25+
label: "r1-qualification-light - the light research agent, more affordable",
26+
value: "r1-qualification-light",
27+
},
28+
],
29+
},
30+
lead: {
31+
propDefinition: [
32+
utopianLabs,
33+
"lead",
34+
],
35+
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/\" } }`",
36+
},
37+
minResearchSteps: {
38+
propDefinition: [
39+
utopianLabs,
40+
"minResearchSteps",
41+
],
42+
},
43+
maxResearchSteps: {
44+
propDefinition: [
45+
utopianLabs,
46+
"maxResearchSteps",
47+
],
48+
},
49+
context: {
50+
propDefinition: [
51+
utopianLabs,
52+
"context",
53+
],
54+
},
55+
additionalOptions: {
56+
propDefinition: [
57+
utopianLabs,
58+
"additionalOptions",
59+
],
60+
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.",
61+
},
62+
},
63+
async run({ $ }) {
64+
const response = await this.utopianLabs.initiateRun({
65+
agent: this.agent,
66+
lead: parseStringAsJSON(this.lead),
67+
min_research_steps: this.minResearchSteps,
68+
max_research_steps: this.maxResearchSteps,
69+
context: this.context,
70+
...parseObjectEntries(this.additionalOptions),
71+
});
72+
$.export("$summary", `Successfully initiated run (ID: ${response.id})`);
73+
return response;
74+
},
75+
};
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import {
2+
parseObjectEntries, parseStringAsJSON,
3+
} from "../../common/utils.mjs";
4+
import utopianLabs from "../../utopian_labs.app.mjs";
5+
6+
export default {
7+
key: "utopian_labs-initiate-research-run",
8+
name: "Initiate Research Run",
9+
description: "Initiate a research run of the R1 agent. [See the documentation](https://docs.utopianlabs.ai/research#initiate-a-research-run)",
10+
version: "0.0.1",
11+
type: "action",
12+
props: {
13+
utopianLabs,
14+
agent: {
15+
propDefinition: [
16+
utopianLabs,
17+
"agent",
18+
],
19+
options: [
20+
{
21+
label: "r1 - a more powerful agent that has access to a larger set of research sources",
22+
value: "r1",
23+
},
24+
{
25+
label: "r1-light - a more affordable version of R1",
26+
value: "r1-light",
27+
},
28+
],
29+
},
30+
lead: {
31+
propDefinition: [
32+
utopianLabs,
33+
"lead",
34+
],
35+
},
36+
minResearchSteps: {
37+
propDefinition: [
38+
utopianLabs,
39+
"minResearchSteps",
40+
],
41+
},
42+
maxResearchSteps: {
43+
propDefinition: [
44+
utopianLabs,
45+
"maxResearchSteps",
46+
],
47+
},
48+
context: {
49+
propDefinition: [
50+
utopianLabs,
51+
"context",
52+
],
53+
},
54+
additionalOptions: {
55+
propDefinition: [
56+
utopianLabs,
57+
"additionalOptions",
58+
],
59+
},
60+
},
61+
async run({ $ }) {
62+
const response = await this.utopianLabs.initiateRun({
63+
agent: this.agent,
64+
lead: parseStringAsJSON(this.lead),
65+
min_research_steps: this.minResearchSteps,
66+
max_research_steps: this.maxResearchSteps,
67+
context: this.context,
68+
...parseObjectEntries(this.additionalOptions),
69+
});
70+
$.export("$summary", `Successfully initiated run (ID: ${response.id})`);
71+
return response;
72+
},
73+
};

0 commit comments

Comments
 (0)