Skip to content

Commit 60a9be6

Browse files
authored
New Components - High Level & Elevenlabs (#16187)
* new components * pnpm-lock.yaml * pnpm-lock.yaml * updates * updates/typos
1 parent 2f3a00e commit 60a9be6

File tree

24 files changed

+598
-43
lines changed

24 files changed

+598
-43
lines changed

components/elevenlabs/actions/add-voice/add-voice.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import elevenlabs from "../../elevenlabs.app.mjs";
55
export default {
66
key: "elevenlabs-add-voice",
77
name: "Add Voice",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
description: "Add a voice from one or more audio files. [See the documentation](https://elevenlabs.io/docs/api-reference/add-voice)",
1010
type: "action",
1111
props: {
@@ -59,7 +59,7 @@ export default {
5959
data,
6060
});
6161

62-
$.export("$summary", `Sucessfully added voice (ID: ${response.voice_id})`);
62+
$.export("$summary", `Successfully added voice (ID: ${response.voice_id})`);
6363
return response;
6464
},
6565
};
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
import elevenlabs from "../../elevenlabs.app.mjs";
2+
3+
export default {
4+
key: "elevenlabs-create-agent",
5+
name: "Create Agent",
6+
description: "Create an agent in Eleventlabs. [See the documentation](https://elevenlabs.io/docs/api-reference/agents/create-agent)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
elevenlabs,
11+
prompt: {
12+
type: "string",
13+
label: "Prompt",
14+
description: "The prompt for the agent",
15+
},
16+
name: {
17+
type: "string",
18+
label: "Name",
19+
description: "A name to make the agent easier to find",
20+
optional: true,
21+
},
22+
llm: {
23+
type: "string",
24+
label: "LLM",
25+
description: "The LLM to query with the prompt and the chat history",
26+
options: [
27+
"gpt-4o-mini",
28+
"gpt-4o",
29+
"gpt-4",
30+
"gpt-4-turbo",
31+
"gpt-3.5-turbo",
32+
"gemini-1.5-pro",
33+
"gemini-1.5-flash",
34+
"gemini-2.0-flash-001",
35+
"gemini-2.0-flash-lite",
36+
"gemini-1.0-pro",
37+
"claude-3-7-sonnet",
38+
"claude-3-5-sonnet",
39+
],
40+
optional: true,
41+
},
42+
temperature: {
43+
type: "string",
44+
label: "Temperature",
45+
description: "The temperature for the LLM. Defaults to `0`",
46+
optional: true,
47+
},
48+
maxTokens: {
49+
type: "integer",
50+
label: "Max Tokens",
51+
description: "If greater than 0, maximum number of tokens the LLM can predict",
52+
optional: true,
53+
},
54+
firstMessage: {
55+
type: "string",
56+
label: "First Message",
57+
description: "If non-empty, the first message the agent will say. If empty, the agent waits for the user to start the discussion.",
58+
optional: true,
59+
},
60+
language: {
61+
type: "string",
62+
label: "Language",
63+
description: "Language of the agent - used for ASR and TTS. Defaults to `en`",
64+
optional: true,
65+
},
66+
maxDurationSeconds: {
67+
type: "integer",
68+
label: "Max Duration in Seconds",
69+
description: "The maximum duration of a conversation in seconds. Defaults to `600`",
70+
optional: true,
71+
},
72+
turnTimeout: {
73+
type: "string",
74+
label: "Turn Timeout",
75+
description: "Maximum wait time for the user’s reply before re-engaging the user. Defaults to `7`",
76+
optional: true,
77+
},
78+
voiceId: {
79+
propDefinition: [
80+
elevenlabs,
81+
"voiceId",
82+
],
83+
description: "The voice ID to use for TTS",
84+
optional: true,
85+
},
86+
ttsModelId: {
87+
type: "string",
88+
label: "TTS Model ID",
89+
description: "The model to use for TTS",
90+
options: [
91+
"eleven_turbo_v2",
92+
"eleven_turbo_v2_5",
93+
"eleven_flash_v2",
94+
"eleven_flash_v2_5",
95+
],
96+
optional: true,
97+
},
98+
},
99+
async run({ $ }) {
100+
const response = await this.elevenlabs.createAgent({
101+
$,
102+
data: {
103+
conversation_config: {
104+
conversation: {
105+
max_duration_seconds: this.maxDurationSeconds,
106+
},
107+
turn: {
108+
turn_timeout: this.turnTimeout && +this.turnTimeout,
109+
},
110+
agent: {
111+
first_message: this.firstMessage,
112+
language: this.language,
113+
prompt: {
114+
prompt: this.prompt,
115+
llm: this.llm,
116+
temperature: this.temperature && +this.temperature,
117+
max_tokens: this.maxTokens,
118+
},
119+
},
120+
tts: {
121+
voice_id: this.voiceId,
122+
model_id: this.ttsModelId,
123+
},
124+
},
125+
name: this.name,
126+
},
127+
});
128+
if (response?.agent_id) {
129+
$.export("$summary", `Successfully created agent with ID: ${response.agent_id}`);
130+
}
131+
return response;
132+
},
133+
};

components/elevenlabs/actions/download-history-items/download-history-items.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import elevenlabs from "../../elevenlabs.app.mjs";
66
export default {
77
key: "elevenlabs-download-history-items",
88
name: "Download History Items",
9-
version: "0.0.2",
9+
version: "0.0.3",
1010
description: "Download one or more history items to your workflow's `tmp` directory. If one history item ID is provided, we will return a single audio file. If more than one history item IDs are provided, we will provide the history items packed into a .zip file. [See the documentation](https://docs.elevenlabs.io/api-reference/history-download)",
1111
type: "action",
1212
props: {

components/elevenlabs/actions/get-audio-from-history-item/get-audio-from-history-item.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import elevenlabs from "../../elevenlabs.app.mjs";
66
export default {
77
key: "elevenlabs-get-audio-from-history-item",
88
name: "Get Audio From History Item",
9-
version: "0.0.2",
9+
version: "0.0.3",
1010
description: "Returns the audio of an history item and converts it to a file. [See the documentation](https://docs.elevenlabs.io/api-reference/history-audio)",
1111
type: "action",
1212
props: {

components/elevenlabs/actions/list-models/list-models.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import elevenlabs from "../../elevenlabs.app.mjs";
33
export default {
44
key: "elevenlabs-list-models",
55
name: "Get Models",
6-
version: "0.0.2",
6+
version: "0.0.3",
77
description: "Gets a list of available models. [See the documentation](https://docs.elevenlabs.io/api-reference/models-get)",
88
type: "action",
99
props: {
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import elevenlabs from "../../elevenlabs.app.mjs";
2+
3+
export default {
4+
key: "elevenlabs-make-outbound-call",
5+
name: "Make Outbound Call",
6+
description: "Handle an outbound call via Twilio with Elevenlabs. [See the documentation](https://elevenlabs.io/docs/api-reference/conversations/twilio-outbound-call)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
elevenlabs,
11+
agentId: {
12+
propDefinition: [
13+
elevenlabs,
14+
"agentId",
15+
],
16+
},
17+
agentPhoneNumberId: {
18+
propDefinition: [
19+
elevenlabs,
20+
"phoneNumberId",
21+
],
22+
},
23+
toNumber: {
24+
type: "string",
25+
label: "To Number",
26+
description: "The recipient phone number",
27+
},
28+
},
29+
async run({ $ }) {
30+
const response = await this.elevenlabs.makeOutboundCall({
31+
$,
32+
data: {
33+
agent_id: this.agentId,
34+
agent_phone_number: this.agentPhoneNumberId,
35+
to_number: this.toNumber,
36+
},
37+
});
38+
if (response?.success) {
39+
$.export("$summary", `Successfully made outbound call to ${this.toNumber}`);
40+
}
41+
return response;
42+
},
43+
};

components/elevenlabs/actions/text-to-speech/text-to-speech.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import elevenlabs from "../../elevenlabs.app.mjs";
66
export default {
77
key: "elevenlabs-text-to-speech",
88
name: "Text To Speech",
9-
version: "0.0.2",
9+
version: "0.0.3",
1010
description: "Retrieve an audio file. [See the documentation](https://docs.elevenlabs.io/api-reference/text-to-speech)",
1111
type: "action",
1212
props: {

components/elevenlabs/elevenlabs.app.mjs

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
propDefinitions: {
77
historyItemId: {
88
type: "string",
9-
label: "History Item Id",
9+
label: "History Item ID",
1010
description: "History item ID to be used.",
1111
async options({ prevContext }) {
1212
const {
@@ -34,7 +34,7 @@ export default {
3434
},
3535
voiceId: {
3636
type: "string",
37-
label: "Voice Id",
37+
label: "Voice ID",
3838
description: "Identifier of the voice that will be used.",
3939
async options() {
4040
const { voices } = await this.listVoices();
@@ -49,7 +49,7 @@ export default {
4949
},
5050
modelId: {
5151
type: "string",
52-
label: "Model Id",
52+
label: "Model ID",
5353
description: "Identifier of the model that will be used. Default: `eleven_monolingual_v1`",
5454
async options() {
5555
const models = await this.listModels();
@@ -62,6 +62,47 @@ export default {
6262
}));
6363
},
6464
},
65+
phoneNumberId: {
66+
type: "string",
67+
label: "Phone Number ID",
68+
description: "Identifier of a phone number to use for the agent",
69+
async options() {
70+
const phoneNumbers = await this.listPhoneNumbers();
71+
return phoneNumbers?.map(({
72+
phone_number_id: value, phone_number: label,
73+
}) => ({
74+
label,
75+
value,
76+
})) || [];
77+
},
78+
},
79+
agentId: {
80+
type: "string",
81+
label: "Agent ID",
82+
description: "Identifier of an agent to use for the outbound call",
83+
async options({ prevContext }) {
84+
const {
85+
agents, next_cursor: cursor,
86+
} = await this.listAgents({
87+
params: {
88+
cursor: prevContext?.cursor,
89+
page_size: 30,
90+
},
91+
});
92+
const options = agents?.map(({
93+
agent_id: value, name: label,
94+
}) => ({
95+
label,
96+
value,
97+
})) || [];
98+
return {
99+
options,
100+
context: {
101+
cursor,
102+
},
103+
};
104+
},
105+
},
65106
},
66107
methods: {
67108
_apiUrl() {
@@ -139,6 +180,32 @@ export default {
139180
...args,
140181
});
141182
},
183+
listPhoneNumbers(args = {}) {
184+
return this._makeRequest({
185+
path: "convai/phone-numbers/",
186+
...args,
187+
});
188+
},
189+
listAgents(args = {}) {
190+
return this._makeRequest({
191+
path: "convai/agents",
192+
...args,
193+
});
194+
},
195+
createAgent(args = {}) {
196+
return this._makeRequest({
197+
method: "POST",
198+
path: "convai/agents/create",
199+
...args,
200+
});
201+
},
202+
makeOutboundCall(args = {}) {
203+
return this._makeRequest({
204+
method: "POST",
205+
path: "convai/twilio/outbound_call",
206+
...args,
207+
});
208+
},
142209
async *paginate({
143210
fn, params = {}, maxResults = null,
144211
}) {

components/elevenlabs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/elevenlabs",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "Pipedream ElevenLabs Components",
55
"main": "elevenlabs.app.mjs",
66
"keywords": [
@@ -13,7 +13,7 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^1.6.0",
16+
"@pipedream/platform": "^3.0.3",
1717
"form-data": "^4.0.0"
1818
}
1919
}

components/elevenlabs/sources/new-history-item/new-history-item.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import elevenlabs from "../../elevenlabs.app.mjs";
44
export default {
55
key: "elevenlabs-new-history-item",
66
name: "New History Item Created",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
description: "Emit new event when a new history item is created.",
99
type: "source",
1010
dedupe: "unique",

0 commit comments

Comments
 (0)