Skip to content

Commit 0cbf137

Browse files
committed
Initiate Copywriting Run
1 parent 861dfc5 commit 0cbf137

File tree

2 files changed

+262
-0
lines changed

2 files changed

+262
-0
lines changed
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: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
export const LANGUAGE_CODE_OPTIONS = [
2+
{
3+
label: "English (United States)",
4+
value: "en-us",
5+
},
6+
{
7+
label: "English (United Kingdom)",
8+
value: "en-uk",
9+
},
10+
{
11+
label: "English (Australia)",
12+
value: "en-au",
13+
},
14+
{
15+
label: "Dutch (Netherlands)",
16+
value: "nl",
17+
},
18+
{
19+
label: "German (Germany)",
20+
value: "de",
21+
},
22+
{
23+
label: "Luxembourgish (Luxembourg)",
24+
value: "lb",
25+
},
26+
{
27+
label: "French (France)",
28+
value: "fr",
29+
},
30+
{
31+
label: "Spanish (Spain and Latin America)",
32+
value: "es",
33+
},
34+
{
35+
label: "Portuguese (Portugal)",
36+
value: "pt",
37+
},
38+
{
39+
label: "Italian (Italy)",
40+
value: "it",
41+
},
42+
{
43+
label: "Greek (Greece)",
44+
value: "gr",
45+
},
46+
{
47+
label: "Russian (Russia)",
48+
value: "ru",
49+
},
50+
{
51+
label: "Turkish (Turkey)",
52+
value: "tr",
53+
},
54+
{
55+
label: "Danish (Denmark)",
56+
value: "da",
57+
},
58+
{
59+
label: "Swedish (Sweden)",
60+
value: "sv",
61+
},
62+
{
63+
label: "Finnish (Finland)",
64+
value: "fi",
65+
},
66+
{
67+
label: "Icelandic (Iceland)",
68+
value: "is",
69+
},
70+
{
71+
label: "Norwegian (Norway)",
72+
value: "no",
73+
},
74+
{
75+
label: "Chinese (China)",
76+
value: "zh",
77+
},
78+
{
79+
label: "Japanese (Japan)",
80+
value: "ja",
81+
},
82+
{
83+
label: "Hindi (India)",
84+
value: "hi",
85+
},
86+
{
87+
label: "Thai (Thailand)",
88+
value: "th",
89+
},
90+
{
91+
label: "Vietnamese (Vietnam)",
92+
value: "vi",
93+
},
94+
{
95+
label: "Burmese (Myanmar)",
96+
value: "my",
97+
},
98+
{
99+
label: "Korean (Korea)",
100+
value: "ko",
101+
},
102+
{
103+
label: "Estonian (Estonia)",
104+
value: "et",
105+
},
106+
{
107+
label: "Lithuanian (Lithuania)",
108+
value: "lt",
109+
},
110+
{
111+
label: "Latvian (Latvia)",
112+
value: "lv",
113+
},
114+
{
115+
label: "Macedonian (North Macedonia)",
116+
value: "mk",
117+
},
118+
{
119+
label: "Indonesian (Indonesia)",
120+
value: "id",
121+
},
122+
{
123+
label: "Czech (Czech Republic)",
124+
value: "cs",
125+
},
126+
{
127+
label: "Polish (Poland)",
128+
value: "pl",
129+
},
130+
{
131+
label: "Slovenian (Slovenia)",
132+
value: "sl",
133+
},
134+
{
135+
label: "Slovak (Slovakia)",
136+
value: "sk",
137+
},
138+
{
139+
label: "Bulgarian (Bulgaria)",
140+
value: "bg",
141+
},
142+
{
143+
label: "Bosnian (Bosnia)",
144+
value: "bs",
145+
},
146+
{
147+
label: "Hungarian (Hungary)",
148+
value: "hu",
149+
},
150+
{
151+
label: "Ukrainian (Ukraine)",
152+
value: "uk",
153+
},
154+
{
155+
label: "Serbian (Serbia)",
156+
value: "sr",
157+
},
158+
{
159+
label: "Romanian (Romania)",
160+
value: "ro",
161+
},
162+
{
163+
label: "Albanian (Albania)",
164+
value: "sq",
165+
},
166+
{
167+
label: "Armenian (Armenia)",
168+
value: "hy",
169+
},
170+
{
171+
label: "Hebrew (Israel)",
172+
value: "he",
173+
},
174+
{
175+
label: "Arabic (Various)",
176+
value: "ar",
177+
},
178+
];

0 commit comments

Comments
 (0)