Skip to content

Commit 335ac53

Browse files
committed
Initiate Qualification Run + reusing props
1 parent d067bec commit 335ac53

File tree

3 files changed

+124
-19
lines changed

3 files changed

+124
-19
lines changed
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+
};

components/utopian_labs/actions/initiate-research-run/initiate-research-run.mjs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,34 @@ export default {
2828
],
2929
},
3030
lead: {
31-
type: "object",
32-
label: "Lead",
33-
description: "The lead to research. [See the documentation](https://docs.utopianlabs.ai/types#the-lead-type) for more information. Example: `{ \"company\": { \"website\": \"https://pipedream.com/\" } }`",
31+
propDefinition: [
32+
utopianLabs,
33+
"lead",
34+
],
3435
},
3536
minResearchSteps: {
36-
type: "integer",
37-
label: "Minimum Research Steps",
38-
description: "Optionally limit R1 to a minimum amount of research steps (default is 0)",
39-
optional: true,
37+
propDefinition: [
38+
utopianLabs,
39+
"minResearchSteps",
40+
],
4041
},
4142
maxResearchSteps: {
42-
type: "integer",
43-
label: "Maximum Research Steps",
44-
description: "Optionally limit R1 to a maximum amount of research steps (default is 5)",
45-
optional: true,
43+
propDefinition: [
44+
utopianLabs,
45+
"maxResearchSteps",
46+
],
4647
},
4748
context: {
48-
type: "string",
49-
label: "Context",
50-
description: "The context for the research run. This is a free-form string that will be used to guide R1's research",
51-
optional: true,
49+
propDefinition: [
50+
utopianLabs,
51+
"context",
52+
],
5253
},
5354
additionalOptions: {
54-
type: "object",
55-
label: "Additional Options",
56-
description: "Additional parameters to send in the request. [See the documentation](https://docs.utopianlabs.ai/research#initiate-a-research-run) for all available parameters. Values will be parsed as JSON where applicable.",
57-
optional: true,
55+
propDefinition: [
56+
utopianLabs,
57+
"additionalOptions",
58+
],
5859
},
5960
},
6061
async run({ $ }) {

components/utopian_labs/utopian_labs.app.mjs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,35 @@ export default {
99
label: "Agent",
1010
description: "The agent to run",
1111
},
12+
lead: {
13+
type: "object",
14+
label: "Lead",
15+
description: "The lead to research. [See the documentation](https://docs.utopianlabs.ai/types#the-lead-type) for more information. Example: `{ \"company\": { \"website\": \"https://pipedream.com/\" } }`",
16+
},
17+
minResearchSteps: {
18+
type: "integer",
19+
label: "Minimum Research Steps",
20+
description: "Optionally limit the agent to a minimum amount of research steps (default is 0)",
21+
optional: true,
22+
},
23+
maxResearchSteps: {
24+
type: "integer",
25+
label: "Maximum Research Steps",
26+
description: "Optionally limit the agent to a maximum amount of research steps (default is 5)",
27+
optional: true,
28+
},
29+
context: {
30+
type: "string",
31+
label: "Context",
32+
description: "The context for the run. This is a free-form string that will be used to guide the agent's research",
33+
optional: true,
34+
},
35+
additionalOptions: {
36+
type: "object",
37+
label: "Additional Options",
38+
description: "Additional parameters to send in the request. [See the documentation](https://docs.utopianlabs.ai/research#initiate-a-research-run) for all available parameters. Values will be parsed as JSON where applicable.",
39+
optional: true,
40+
},
1241
},
1342
methods: {
1443
_client() {

0 commit comments

Comments
 (0)