phonic 0.30.7 → 0.30.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/agents/client/Client.d.ts +13 -4
- package/dist/cjs/api/resources/agents/client/Client.js +15 -8
- package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +9 -4
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +14 -6
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +2 -0
- package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +4 -1
- package/dist/cjs/api/resources/conversations/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/conversations/client/Client.js +4 -5
- package/dist/cjs/api/resources/conversations/client/Socket.d.ts +1 -1
- package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +1 -0
- package/dist/cjs/api/resources/extractionSchemas/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/extractionSchemas/client/Client.js +3 -5
- package/dist/cjs/api/resources/projects/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/projects/client/Client.js +3 -5
- package/dist/cjs/api/resources/projects/client/requests/UpdateProjectRequest.d.ts +1 -1
- package/dist/cjs/api/resources/tools/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/tools/client/Client.js +3 -5
- package/dist/cjs/api/resources/voices/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/voices/client/Client.js +3 -5
- package/dist/cjs/api/types/Agent.d.ts +10 -6
- package/dist/cjs/api/types/Agent.js +2 -0
- package/dist/cjs/api/types/ConfigPayload.d.ts +10 -4
- package/dist/cjs/api/types/ConfigPayload.js +4 -0
- package/dist/cjs/api/types/Conversation.d.ts +19 -6
- package/dist/cjs/api/types/Conversation.js +11 -0
- package/dist/cjs/api/types/ConversationExtraction.d.ts +1 -1
- package/dist/cjs/api/types/ConversationItem.d.ts +13 -13
- package/dist/cjs/api/types/CreateAgentRequest.d.ts +10 -5
- package/dist/cjs/api/types/CreateAgentRequest.js +2 -0
- package/dist/cjs/api/types/ExtractionField.d.ts +1 -1
- package/dist/cjs/api/types/InputTextPayload.d.ts +2 -0
- package/dist/cjs/api/types/OutboundCallConfig.d.ts +4 -2
- package/dist/cjs/api/types/Project.d.ts +1 -1
- package/dist/cjs/api/types/ToolCallOutputProcessedPayload.d.ts +8 -8
- package/dist/cjs/api/types/Voice.d.ts +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/agents/client/Client.d.mts +13 -4
- package/dist/esm/api/resources/agents/client/Client.mjs +15 -8
- package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +9 -4
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +14 -6
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.mjs +2 -0
- package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +4 -1
- package/dist/esm/api/resources/conversations/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/conversations/client/Client.mjs +4 -5
- package/dist/esm/api/resources/conversations/client/Socket.d.mts +1 -1
- package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +1 -0
- package/dist/esm/api/resources/extractionSchemas/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/extractionSchemas/client/Client.mjs +3 -5
- package/dist/esm/api/resources/projects/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/projects/client/Client.mjs +3 -5
- package/dist/esm/api/resources/projects/client/requests/UpdateProjectRequest.d.mts +1 -1
- package/dist/esm/api/resources/tools/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/tools/client/Client.mjs +3 -5
- package/dist/esm/api/resources/voices/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/voices/client/Client.mjs +3 -5
- package/dist/esm/api/types/Agent.d.mts +10 -6
- package/dist/esm/api/types/Agent.mjs +2 -0
- package/dist/esm/api/types/ConfigPayload.d.mts +10 -4
- package/dist/esm/api/types/ConfigPayload.mjs +4 -0
- package/dist/esm/api/types/Conversation.d.mts +19 -6
- package/dist/esm/api/types/Conversation.mjs +10 -1
- package/dist/esm/api/types/ConversationExtraction.d.mts +1 -1
- package/dist/esm/api/types/ConversationItem.d.mts +13 -13
- package/dist/esm/api/types/CreateAgentRequest.d.mts +10 -5
- package/dist/esm/api/types/CreateAgentRequest.mjs +2 -0
- package/dist/esm/api/types/ExtractionField.d.mts +1 -1
- package/dist/esm/api/types/InputTextPayload.d.mts +2 -0
- package/dist/esm/api/types/OutboundCallConfig.d.mts +4 -2
- package/dist/esm/api/types/Project.d.mts +1 -1
- package/dist/esm/api/types/ToolCallOutputProcessedPayload.d.mts +8 -8
- package/dist/esm/api/types/Voice.d.mts +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
- package/reference.md +13 -3
package/README.md
CHANGED
|
@@ -34,7 +34,9 @@ await client.agents.create({
|
|
|
34
34
|
welcome_message: "Hi {{customer_name}}. How can I help you today?",
|
|
35
35
|
system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
36
36
|
template_variables: {
|
|
37
|
-
customer_name: {
|
|
37
|
+
customer_name: {
|
|
38
|
+
default_value: null,
|
|
39
|
+
},
|
|
38
40
|
subject: {
|
|
39
41
|
default_value: "Chess",
|
|
40
42
|
},
|
|
@@ -42,6 +44,7 @@ await client.agents.create({
|
|
|
42
44
|
tools: ["keypad_input"],
|
|
43
45
|
no_input_poke_sec: 30,
|
|
44
46
|
no_input_poke_text: "Are you still there?",
|
|
47
|
+
recognized_languages: ["en", "es"],
|
|
45
48
|
boosted_keywords: ["Load ID", "dispatch"],
|
|
46
49
|
configuration_endpoint: {
|
|
47
50
|
url: "https://api.example.com/config",
|
package/dist/cjs/Client.js
CHANGED
|
@@ -50,8 +50,8 @@ class PhonicClient {
|
|
|
50
50
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
51
51
|
"X-Fern-Language": "JavaScript",
|
|
52
52
|
"X-Fern-SDK-Name": "phonic",
|
|
53
|
-
"X-Fern-SDK-Version": "0.30.
|
|
54
|
-
"User-Agent": "phonic/0.30.
|
|
53
|
+
"X-Fern-SDK-Version": "0.30.9",
|
|
54
|
+
"User-Agent": "phonic/0.30.9",
|
|
55
55
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
56
56
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
57
57
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -67,7 +67,9 @@ export declare class Agents {
|
|
|
67
67
|
* welcome_message: "Hi {{customer_name}}. How can I help you today?",
|
|
68
68
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
69
69
|
* template_variables: {
|
|
70
|
-
* "customer_name": {
|
|
70
|
+
* "customer_name": {
|
|
71
|
+
* default_value: null
|
|
72
|
+
* },
|
|
71
73
|
* "subject": {
|
|
72
74
|
* default_value: "Chess"
|
|
73
75
|
* }
|
|
@@ -75,6 +77,7 @@ export declare class Agents {
|
|
|
75
77
|
* tools: ["keypad_input"],
|
|
76
78
|
* no_input_poke_sec: 30,
|
|
77
79
|
* no_input_poke_text: "Are you still there?",
|
|
80
|
+
* recognized_languages: ["en", "es"],
|
|
78
81
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
79
82
|
* configuration_endpoint: {
|
|
80
83
|
* url: "https://api.example.com/config",
|
|
@@ -108,7 +111,9 @@ export declare class Agents {
|
|
|
108
111
|
* welcome_message: "Hi {{customer_name}}. How can I help you today?",
|
|
109
112
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
110
113
|
* template_variables: {
|
|
111
|
-
* "customer_name": {
|
|
114
|
+
* "customer_name": {
|
|
115
|
+
* default_value: null
|
|
116
|
+
* },
|
|
112
117
|
* "subject": {
|
|
113
118
|
* default_value: "Chess"
|
|
114
119
|
* }
|
|
@@ -116,6 +121,7 @@ export declare class Agents {
|
|
|
116
121
|
* tools: ["keypad_input"],
|
|
117
122
|
* no_input_poke_sec: 30,
|
|
118
123
|
* no_input_poke_text: "Are you still there?",
|
|
124
|
+
* recognized_languages: ["en", "es"],
|
|
119
125
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
120
126
|
* configuration_endpoint: {
|
|
121
127
|
* url: "https://api.example.com/config",
|
|
@@ -185,7 +191,9 @@ export declare class Agents {
|
|
|
185
191
|
* welcome_message: "Hi {{customer_name}}. How can I help you today?",
|
|
186
192
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
187
193
|
* template_variables: {
|
|
188
|
-
* "customer_name": {
|
|
194
|
+
* "customer_name": {
|
|
195
|
+
* default_value: null
|
|
196
|
+
* },
|
|
189
197
|
* "subject": {
|
|
190
198
|
* default_value: "Chess"
|
|
191
199
|
* }
|
|
@@ -193,6 +201,7 @@ export declare class Agents {
|
|
|
193
201
|
* tools: ["keypad_input"],
|
|
194
202
|
* no_input_poke_sec: 30,
|
|
195
203
|
* no_input_poke_text: "Are you still there?",
|
|
204
|
+
* recognized_languages: ["en", "es"],
|
|
196
205
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
197
206
|
* configuration_endpoint: {
|
|
198
207
|
* url: "https://api.example.com/config",
|
|
@@ -205,5 +214,5 @@ export declare class Agents {
|
|
|
205
214
|
*/
|
|
206
215
|
update(nameOrId: string, request?: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
|
|
207
216
|
private __update;
|
|
208
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
217
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
209
218
|
}
|
|
@@ -157,7 +157,9 @@ class Agents {
|
|
|
157
157
|
* welcome_message: "Hi {{customer_name}}. How can I help you today?",
|
|
158
158
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
159
159
|
* template_variables: {
|
|
160
|
-
* "customer_name": {
|
|
160
|
+
* "customer_name": {
|
|
161
|
+
* default_value: null
|
|
162
|
+
* },
|
|
161
163
|
* "subject": {
|
|
162
164
|
* default_value: "Chess"
|
|
163
165
|
* }
|
|
@@ -165,6 +167,7 @@ class Agents {
|
|
|
165
167
|
* tools: ["keypad_input"],
|
|
166
168
|
* no_input_poke_sec: 30,
|
|
167
169
|
* no_input_poke_text: "Are you still there?",
|
|
170
|
+
* recognized_languages: ["en", "es"],
|
|
168
171
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
169
172
|
* configuration_endpoint: {
|
|
170
173
|
* url: "https://api.example.com/config",
|
|
@@ -259,7 +262,9 @@ class Agents {
|
|
|
259
262
|
* welcome_message: "Hi {{customer_name}}. How can I help you today?",
|
|
260
263
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
261
264
|
* template_variables: {
|
|
262
|
-
* "customer_name": {
|
|
265
|
+
* "customer_name": {
|
|
266
|
+
* default_value: null
|
|
267
|
+
* },
|
|
263
268
|
* "subject": {
|
|
264
269
|
* default_value: "Chess"
|
|
265
270
|
* }
|
|
@@ -267,6 +272,7 @@ class Agents {
|
|
|
267
272
|
* tools: ["keypad_input"],
|
|
268
273
|
* no_input_poke_sec: 30,
|
|
269
274
|
* no_input_poke_text: "Are you still there?",
|
|
275
|
+
* recognized_languages: ["en", "es"],
|
|
270
276
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
271
277
|
* configuration_endpoint: {
|
|
272
278
|
* url: "https://api.example.com/config",
|
|
@@ -501,7 +507,9 @@ class Agents {
|
|
|
501
507
|
* welcome_message: "Hi {{customer_name}}. How can I help you today?",
|
|
502
508
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
503
509
|
* template_variables: {
|
|
504
|
-
* "customer_name": {
|
|
510
|
+
* "customer_name": {
|
|
511
|
+
* default_value: null
|
|
512
|
+
* },
|
|
505
513
|
* "subject": {
|
|
506
514
|
* default_value: "Chess"
|
|
507
515
|
* }
|
|
@@ -509,6 +517,7 @@ class Agents {
|
|
|
509
517
|
* tools: ["keypad_input"],
|
|
510
518
|
* no_input_poke_sec: 30,
|
|
511
519
|
* no_input_poke_text: "Are you still there?",
|
|
520
|
+
* recognized_languages: ["en", "es"],
|
|
512
521
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
513
522
|
* configuration_endpoint: {
|
|
514
523
|
* url: "https://api.example.com/config",
|
|
@@ -584,12 +593,10 @@ class Agents {
|
|
|
584
593
|
return __awaiter(this, void 0, void 0, function* () {
|
|
585
594
|
var _a;
|
|
586
595
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
587
|
-
if (bearer
|
|
588
|
-
|
|
589
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
590
|
-
});
|
|
596
|
+
if (bearer != null) {
|
|
597
|
+
return `Bearer ${bearer}`;
|
|
591
598
|
}
|
|
592
|
-
return
|
|
599
|
+
return undefined;
|
|
593
600
|
});
|
|
594
601
|
}
|
|
595
602
|
}
|
|
@@ -15,7 +15,9 @@ import * as Phonic from "../../../../index.js";
|
|
|
15
15
|
* welcome_message: "Hi {{customer_name}}. How can I help you today?",
|
|
16
16
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
17
17
|
* template_variables: {
|
|
18
|
-
* "customer_name": {
|
|
18
|
+
* "customer_name": {
|
|
19
|
+
* default_value: null
|
|
20
|
+
* },
|
|
19
21
|
* "subject": {
|
|
20
22
|
* default_value: "Chess"
|
|
21
23
|
* }
|
|
@@ -23,6 +25,7 @@ import * as Phonic from "../../../../index.js";
|
|
|
23
25
|
* tools: ["keypad_input"],
|
|
24
26
|
* no_input_poke_sec: 30,
|
|
25
27
|
* no_input_poke_text: "Are you still there?",
|
|
28
|
+
* recognized_languages: ["en", "es"],
|
|
26
29
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
27
30
|
* configuration_endpoint: {
|
|
28
31
|
* url: "https://api.example.com/config",
|
|
@@ -38,7 +41,7 @@ export interface AgentsCreateRequest {
|
|
|
38
41
|
project?: string;
|
|
39
42
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
40
43
|
name: string;
|
|
41
|
-
phone_number?: "assign-automatically";
|
|
44
|
+
phone_number?: "assign-automatically" | null;
|
|
42
45
|
/** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
|
|
43
46
|
timezone?: string;
|
|
44
47
|
/** The voice ID to use. */
|
|
@@ -60,13 +63,15 @@ export interface AgentsCreateRequest {
|
|
|
60
63
|
/** Array of task objects with `name` and `description` fields. */
|
|
61
64
|
tasks?: Phonic.Task[];
|
|
62
65
|
/** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
|
|
63
|
-
no_input_poke_sec?: number;
|
|
66
|
+
no_input_poke_sec?: number | null;
|
|
64
67
|
/** The message to send after the specified silence. */
|
|
65
68
|
no_input_poke_text?: string;
|
|
66
69
|
/** Seconds of silence before ending the conversation. */
|
|
67
70
|
no_input_end_conversation_sec?: number;
|
|
71
|
+
/** Array of ISO 639-1 language codes that the agent should be able to recognize */
|
|
72
|
+
recognized_languages?: string[];
|
|
68
73
|
/** These words, or short phrases, will be more accurately recognized by the agent. */
|
|
69
74
|
boosted_keywords?: string[];
|
|
70
75
|
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint when to get configuration options. */
|
|
71
|
-
configuration_endpoint?: Phonic.CreateAgentRequest.ConfigurationEndpoint;
|
|
76
|
+
configuration_endpoint?: Phonic.CreateAgentRequest.ConfigurationEndpoint | null;
|
|
72
77
|
}
|
|
@@ -15,7 +15,9 @@ import * as Phonic from "../../../../index.js";
|
|
|
15
15
|
* welcome_message: "Hi {{customer_name}}. How can I help you today?",
|
|
16
16
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
17
17
|
* template_variables: {
|
|
18
|
-
* "customer_name": {
|
|
18
|
+
* "customer_name": {
|
|
19
|
+
* default_value: null
|
|
20
|
+
* },
|
|
19
21
|
* "subject": {
|
|
20
22
|
* default_value: "Chess"
|
|
21
23
|
* }
|
|
@@ -23,6 +25,7 @@ import * as Phonic from "../../../../index.js";
|
|
|
23
25
|
* tools: ["keypad_input"],
|
|
24
26
|
* no_input_poke_sec: 30,
|
|
25
27
|
* no_input_poke_text: "Are you still there?",
|
|
28
|
+
* recognized_languages: ["en", "es"],
|
|
26
29
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
27
30
|
* configuration_endpoint: {
|
|
28
31
|
* url: "https://api.example.com/config",
|
|
@@ -38,7 +41,7 @@ export interface UpdateAgentRequest {
|
|
|
38
41
|
project?: string;
|
|
39
42
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
40
43
|
name?: string;
|
|
41
|
-
phone_number?: "assign-automatically";
|
|
44
|
+
phone_number?: "assign-automatically" | null;
|
|
42
45
|
/** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
|
|
43
46
|
timezone?: string;
|
|
44
47
|
/** The voice ID to use. */
|
|
@@ -60,28 +63,33 @@ export interface UpdateAgentRequest {
|
|
|
60
63
|
/** Array of task objects with `name` and `description` fields. */
|
|
61
64
|
tasks?: Phonic.Task[];
|
|
62
65
|
/** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
|
|
63
|
-
no_input_poke_sec?: number;
|
|
66
|
+
no_input_poke_sec?: number | null;
|
|
64
67
|
/** The message to send after the specified silence. */
|
|
65
68
|
no_input_poke_text?: string;
|
|
66
69
|
/** Seconds of silence before ending the conversation. */
|
|
67
70
|
no_input_end_conversation_sec?: number;
|
|
71
|
+
/** Array of ISO 639-1 language codes that the agent should be able to recognize */
|
|
72
|
+
recognized_languages?: string[];
|
|
68
73
|
/** These words, or short phrases, will be more accurately recognized by the agent. */
|
|
69
74
|
boosted_keywords?: string[];
|
|
70
75
|
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint when to get configuration options. */
|
|
71
|
-
configuration_endpoint?: UpdateAgentRequest.ConfigurationEndpoint;
|
|
76
|
+
configuration_endpoint?: UpdateAgentRequest.ConfigurationEndpoint | null;
|
|
72
77
|
}
|
|
73
78
|
export declare namespace UpdateAgentRequest {
|
|
74
79
|
/**
|
|
75
80
|
* The audio format of the agent.
|
|
76
81
|
*/
|
|
77
|
-
type AudioFormat = "pcm_44100" | "mulaw_8000";
|
|
82
|
+
type AudioFormat = "pcm_44100" | "pcm_16000" | "pcm_8000" | "mulaw_8000";
|
|
78
83
|
const AudioFormat: {
|
|
79
84
|
readonly Pcm44100: "pcm_44100";
|
|
85
|
+
readonly Pcm16000: "pcm_16000";
|
|
86
|
+
readonly Pcm8000: "pcm_8000";
|
|
80
87
|
readonly Mulaw8000: "mulaw_8000";
|
|
81
88
|
};
|
|
82
89
|
namespace TemplateVariables {
|
|
83
90
|
interface Value {
|
|
84
|
-
default_value
|
|
91
|
+
default_value: string | null;
|
|
92
|
+
is_boosted_keyword?: boolean;
|
|
85
93
|
}
|
|
86
94
|
}
|
|
87
95
|
type Tools = Tools.Item[];
|
|
@@ -8,6 +8,8 @@ var UpdateAgentRequest;
|
|
|
8
8
|
(function (UpdateAgentRequest) {
|
|
9
9
|
UpdateAgentRequest.AudioFormat = {
|
|
10
10
|
Pcm44100: "pcm_44100",
|
|
11
|
+
Pcm16000: "pcm_16000",
|
|
12
|
+
Pcm8000: "pcm_8000",
|
|
11
13
|
Mulaw8000: "mulaw_8000",
|
|
12
14
|
};
|
|
13
15
|
})(UpdateAgentRequest || (exports.UpdateAgentRequest = UpdateAgentRequest = {}));
|
|
@@ -15,7 +15,9 @@ import * as Phonic from "../../../../index.js";
|
|
|
15
15
|
* welcome_message: "Hi {{customer_name}}. How can I help you today?",
|
|
16
16
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
17
17
|
* template_variables: {
|
|
18
|
-
* "customer_name": {
|
|
18
|
+
* "customer_name": {
|
|
19
|
+
* default_value: null
|
|
20
|
+
* },
|
|
19
21
|
* "subject": {
|
|
20
22
|
* default_value: "Chess"
|
|
21
23
|
* }
|
|
@@ -23,6 +25,7 @@ import * as Phonic from "../../../../index.js";
|
|
|
23
25
|
* tools: ["keypad_input"],
|
|
24
26
|
* no_input_poke_sec: 30,
|
|
25
27
|
* no_input_poke_text: "Are you still there?",
|
|
28
|
+
* recognized_languages: ["en", "es"],
|
|
26
29
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
27
30
|
* configuration_endpoint: {
|
|
28
31
|
* url: "https://api.example.com/config",
|
|
@@ -205,6 +205,7 @@ export declare class Conversations {
|
|
|
205
205
|
* no_input_poke_sec: 30,
|
|
206
206
|
* no_input_poke_text: "Are you still there?",
|
|
207
207
|
* no_input_end_conversation_sec: 180,
|
|
208
|
+
* recognized_languages: ["en", "es"],
|
|
208
209
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
209
210
|
* tools: ["keypad_input"]
|
|
210
211
|
* }
|
|
@@ -232,5 +233,5 @@ export declare class Conversations {
|
|
|
232
233
|
sipOutboundCall(request: Phonic.ConversationsSipOutboundCallRequest, requestOptions?: Conversations.RequestOptions): core.HttpResponsePromise<Phonic.ConversationsSipOutboundCallResponse>;
|
|
233
234
|
private __sipOutboundCall;
|
|
234
235
|
connect(args?: Conversations.ConnectArgs): Promise<ConversationsSocket>;
|
|
235
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
236
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
236
237
|
}
|
|
@@ -713,6 +713,7 @@ class Conversations {
|
|
|
713
713
|
* no_input_poke_sec: 30,
|
|
714
714
|
* no_input_poke_text: "Are you still there?",
|
|
715
715
|
* no_input_end_conversation_sec: 180,
|
|
716
|
+
* recognized_languages: ["en", "es"],
|
|
716
717
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
717
718
|
* tools: ["keypad_input"]
|
|
718
719
|
* }
|
|
@@ -892,12 +893,10 @@ class Conversations {
|
|
|
892
893
|
return __awaiter(this, void 0, void 0, function* () {
|
|
893
894
|
var _a;
|
|
894
895
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
895
|
-
if (bearer
|
|
896
|
-
|
|
897
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
898
|
-
});
|
|
896
|
+
if (bearer != null) {
|
|
897
|
+
return `Bearer ${bearer}`;
|
|
899
898
|
}
|
|
900
|
-
return
|
|
899
|
+
return undefined;
|
|
901
900
|
});
|
|
902
901
|
}
|
|
903
902
|
}
|
|
@@ -7,7 +7,7 @@ export declare namespace ConversationsSocket {
|
|
|
7
7
|
interface Args {
|
|
8
8
|
socket: core.ReconnectingWebSocket;
|
|
9
9
|
}
|
|
10
|
-
type Response = Phonic.ReadyToStartConversationPayload | Phonic.ConversationCreatedPayload | Phonic.InputTextPayload | Phonic.InputCancelledPayload | Phonic.UserStartedSpeakingPayload | Phonic.UserFinishedSpeakingPayload | Phonic.DtmfPayload | Phonic.ToolCallPayload | Phonic.ToolCallOutputProcessedPayload | Phonic.ToolCallInterruptedPayload | Phonic.AssistantChoseNotToRespondPayload | Phonic.AssistantEndedConversationPayload | Phonic.ErrorPayload;
|
|
10
|
+
type Response = Phonic.ReadyToStartConversationPayload | Phonic.ConversationCreatedPayload | Phonic.InputTextPayload | Phonic.InputCancelledPayload | Phonic.AudioChunkResponsePayload | Phonic.UserStartedSpeakingPayload | Phonic.UserFinishedSpeakingPayload | Phonic.DtmfPayload | Phonic.ToolCallPayload | Phonic.ToolCallOutputProcessedPayload | Phonic.ToolCallInterruptedPayload | Phonic.AssistantChoseNotToRespondPayload | Phonic.AssistantEndedConversationPayload | Phonic.ErrorPayload;
|
|
11
11
|
type EventHandlers = {
|
|
12
12
|
open?: () => void;
|
|
13
13
|
message?: (message: Response) => void;
|
|
@@ -18,6 +18,7 @@ import * as Phonic from "../../../../index.js";
|
|
|
18
18
|
* no_input_poke_sec: 30,
|
|
19
19
|
* no_input_poke_text: "Are you still there?",
|
|
20
20
|
* no_input_end_conversation_sec: 180,
|
|
21
|
+
* recognized_languages: ["en", "es"],
|
|
21
22
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
22
23
|
* tools: ["keypad_input"]
|
|
23
24
|
* }
|
|
@@ -138,5 +138,5 @@ export declare class ExtractionSchemas {
|
|
|
138
138
|
*/
|
|
139
139
|
update(nameOrId: string, request?: Phonic.UpdateExtractionSchemaRequest, requestOptions?: ExtractionSchemas.RequestOptions): core.HttpResponsePromise<Phonic.ExtractionSchemasUpdateResponse>;
|
|
140
140
|
private __update;
|
|
141
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
141
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
142
142
|
}
|
|
@@ -461,12 +461,10 @@ class ExtractionSchemas {
|
|
|
461
461
|
return __awaiter(this, void 0, void 0, function* () {
|
|
462
462
|
var _a;
|
|
463
463
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
464
|
-
if (bearer
|
|
465
|
-
|
|
466
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
467
|
-
});
|
|
464
|
+
if (bearer != null) {
|
|
465
|
+
return `Bearer ${bearer}`;
|
|
468
466
|
}
|
|
469
|
-
return
|
|
467
|
+
return undefined;
|
|
470
468
|
});
|
|
471
469
|
}
|
|
472
470
|
}
|
|
@@ -153,5 +153,5 @@ export declare class Projects {
|
|
|
153
153
|
*/
|
|
154
154
|
createEvalPrompt(id: string, request: Phonic.CreateConversationEvalPromptRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsCreateEvalPromptResponse>;
|
|
155
155
|
private __createEvalPrompt;
|
|
156
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
156
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
157
157
|
}
|
|
@@ -572,12 +572,10 @@ class Projects {
|
|
|
572
572
|
return __awaiter(this, void 0, void 0, function* () {
|
|
573
573
|
var _a;
|
|
574
574
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
575
|
-
if (bearer
|
|
576
|
-
|
|
577
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
578
|
-
});
|
|
575
|
+
if (bearer != null) {
|
|
576
|
+
return `Bearer ${bearer}`;
|
|
579
577
|
}
|
|
580
|
-
return
|
|
578
|
+
return undefined;
|
|
581
579
|
});
|
|
582
580
|
}
|
|
583
581
|
}
|
|
@@ -166,5 +166,5 @@ export declare class Tools {
|
|
|
166
166
|
*/
|
|
167
167
|
update(nameOrId: string, request?: Phonic.UpdateToolRequest, requestOptions?: Tools.RequestOptions): core.HttpResponsePromise<Phonic.ToolsUpdateResponse>;
|
|
168
168
|
private __update;
|
|
169
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
169
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
170
170
|
}
|
|
@@ -482,12 +482,10 @@ class Tools {
|
|
|
482
482
|
return __awaiter(this, void 0, void 0, function* () {
|
|
483
483
|
var _a;
|
|
484
484
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
485
|
-
if (bearer
|
|
486
|
-
|
|
487
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
488
|
-
});
|
|
485
|
+
if (bearer != null) {
|
|
486
|
+
return `Bearer ${bearer}`;
|
|
489
487
|
}
|
|
490
|
-
return
|
|
488
|
+
return undefined;
|
|
491
489
|
});
|
|
492
490
|
}
|
|
493
491
|
}
|
|
@@ -61,5 +61,5 @@ export declare class Voices {
|
|
|
61
61
|
*/
|
|
62
62
|
get(id: string, requestOptions?: Voices.RequestOptions): core.HttpResponsePromise<Phonic.VoicesGetResponse>;
|
|
63
63
|
private __get;
|
|
64
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
64
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
65
65
|
}
|
|
@@ -193,12 +193,10 @@ class Voices {
|
|
|
193
193
|
return __awaiter(this, void 0, void 0, function* () {
|
|
194
194
|
var _a;
|
|
195
195
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
196
|
-
if (bearer
|
|
197
|
-
|
|
198
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
199
|
-
});
|
|
196
|
+
if (bearer != null) {
|
|
197
|
+
return `Bearer ${bearer}`;
|
|
200
198
|
}
|
|
201
|
-
return
|
|
199
|
+
return undefined;
|
|
202
200
|
});
|
|
203
201
|
}
|
|
204
202
|
}
|
|
@@ -8,7 +8,7 @@ export interface Agent {
|
|
|
8
8
|
/** The name of the agent. */
|
|
9
9
|
name: string;
|
|
10
10
|
/** The phone number that the agent uses to accept and initiate phone calls. `null` if the agent is not associated with a phone number, in which can the agent can be used via WebSockets. */
|
|
11
|
-
phone_number
|
|
11
|
+
phone_number: string | null;
|
|
12
12
|
/** The project the agent belongs to. */
|
|
13
13
|
project: Agent.Project;
|
|
14
14
|
/** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
|
|
@@ -22,7 +22,7 @@ export interface Agent {
|
|
|
22
22
|
/** The background noise level of the agent. Must be between 0 and 1. */
|
|
23
23
|
background_noise_level: number;
|
|
24
24
|
/** Message to play when the conversation starts. */
|
|
25
|
-
welcome_message
|
|
25
|
+
welcome_message: string | null;
|
|
26
26
|
/** Instructions for the conversation. */
|
|
27
27
|
system_prompt: string;
|
|
28
28
|
/** Template variables that the agent can use in the welcome message and the system prompt. */
|
|
@@ -32,15 +32,17 @@ export interface Agent {
|
|
|
32
32
|
/** Tasks for the agent to complete during the conversation. */
|
|
33
33
|
tasks: Phonic.Task[];
|
|
34
34
|
/** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
|
|
35
|
-
no_input_poke_sec
|
|
35
|
+
no_input_poke_sec: number | null;
|
|
36
36
|
/** The message to send after the specified silence. */
|
|
37
37
|
no_input_poke_text: string;
|
|
38
38
|
/** Seconds of silence before ending the conversation. */
|
|
39
39
|
no_input_end_conversation_sec: number;
|
|
40
|
+
/** Array of ISO 639-1 language codes that the agent should be able to recognize */
|
|
41
|
+
recognized_languages: string[];
|
|
40
42
|
/** These words, or short phrases, will be more accurately recognized by the agent. */
|
|
41
43
|
boosted_keywords: string[];
|
|
42
44
|
/** When not `null`, the agent will call this endpoint to get configuration options. */
|
|
43
|
-
configuration_endpoint
|
|
45
|
+
configuration_endpoint: Agent.ConfigurationEndpoint | null;
|
|
44
46
|
}
|
|
45
47
|
export declare namespace Agent {
|
|
46
48
|
/**
|
|
@@ -53,14 +55,16 @@ export declare namespace Agent {
|
|
|
53
55
|
/**
|
|
54
56
|
* The audio format of the agent. If the agent has a phone number, the audio format will be `mulaw_8000`.
|
|
55
57
|
*/
|
|
56
|
-
type AudioFormat = "pcm_44100" | "mulaw_8000";
|
|
58
|
+
type AudioFormat = "pcm_44100" | "pcm_16000" | "pcm_8000" | "mulaw_8000";
|
|
57
59
|
const AudioFormat: {
|
|
58
60
|
readonly Pcm44100: "pcm_44100";
|
|
61
|
+
readonly Pcm16000: "pcm_16000";
|
|
62
|
+
readonly Pcm8000: "pcm_8000";
|
|
59
63
|
readonly Mulaw8000: "mulaw_8000";
|
|
60
64
|
};
|
|
61
65
|
namespace TemplateVariables {
|
|
62
66
|
interface Value {
|
|
63
|
-
default_value
|
|
67
|
+
default_value: string | null;
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
type Tools = Tools.Item[];
|
|
@@ -16,7 +16,7 @@ export interface ConfigPayload {
|
|
|
16
16
|
/** Background noise level for the conversation */
|
|
17
17
|
background_noise_level?: number;
|
|
18
18
|
/** Message to play when conversation starts */
|
|
19
|
-
welcome_message?: string;
|
|
19
|
+
welcome_message?: string | null;
|
|
20
20
|
/** Voice ID to use for speech synthesis */
|
|
21
21
|
voice_id?: string;
|
|
22
22
|
/** Audio input format */
|
|
@@ -36,11 +36,13 @@ export interface ConfigPayload {
|
|
|
36
36
|
/** Enable transcript RAG */
|
|
37
37
|
enable_transcripts_rag?: boolean;
|
|
38
38
|
/** Seconds of silence before poke message */
|
|
39
|
-
no_input_poke_sec?: number;
|
|
39
|
+
no_input_poke_sec?: number | null;
|
|
40
40
|
/** Poke message text */
|
|
41
41
|
no_input_poke_text?: string;
|
|
42
42
|
/** Seconds of silence before ending conversation */
|
|
43
43
|
no_input_end_conversation_sec?: number;
|
|
44
|
+
/** Array of ISO 639-1 language codes that the agent should be able to recognize */
|
|
45
|
+
recognized_languages?: string[];
|
|
44
46
|
/** Keywords to boost in speech recognition */
|
|
45
47
|
boosted_keywords?: string[];
|
|
46
48
|
/** Tools available to the assistant */
|
|
@@ -52,17 +54,21 @@ export declare namespace ConfigPayload {
|
|
|
52
54
|
/**
|
|
53
55
|
* Audio input format
|
|
54
56
|
*/
|
|
55
|
-
type InputFormat = "pcm_44100" | "mulaw_8000";
|
|
57
|
+
type InputFormat = "pcm_44100" | "pcm_16000" | "pcm_8000" | "mulaw_8000";
|
|
56
58
|
const InputFormat: {
|
|
57
59
|
readonly Pcm44100: "pcm_44100";
|
|
60
|
+
readonly Pcm16000: "pcm_16000";
|
|
61
|
+
readonly Pcm8000: "pcm_8000";
|
|
58
62
|
readonly Mulaw8000: "mulaw_8000";
|
|
59
63
|
};
|
|
60
64
|
/**
|
|
61
65
|
* Audio output format
|
|
62
66
|
*/
|
|
63
|
-
type OutputFormat = "pcm_44100" | "mulaw_8000";
|
|
67
|
+
type OutputFormat = "pcm_44100" | "pcm_16000" | "pcm_8000" | "mulaw_8000";
|
|
64
68
|
const OutputFormat: {
|
|
65
69
|
readonly Pcm44100: "pcm_44100";
|
|
70
|
+
readonly Pcm16000: "pcm_16000";
|
|
71
|
+
readonly Pcm8000: "pcm_8000";
|
|
66
72
|
readonly Mulaw8000: "mulaw_8000";
|
|
67
73
|
};
|
|
68
74
|
}
|
|
@@ -8,10 +8,14 @@ var ConfigPayload;
|
|
|
8
8
|
(function (ConfigPayload) {
|
|
9
9
|
ConfigPayload.InputFormat = {
|
|
10
10
|
Pcm44100: "pcm_44100",
|
|
11
|
+
Pcm16000: "pcm_16000",
|
|
12
|
+
Pcm8000: "pcm_8000",
|
|
11
13
|
Mulaw8000: "mulaw_8000",
|
|
12
14
|
};
|
|
13
15
|
ConfigPayload.OutputFormat = {
|
|
14
16
|
Pcm44100: "pcm_44100",
|
|
17
|
+
Pcm16000: "pcm_16000",
|
|
18
|
+
Pcm8000: "pcm_8000",
|
|
15
19
|
Mulaw8000: "mulaw_8000",
|
|
16
20
|
};
|
|
17
21
|
})(ConfigPayload || (exports.ConfigPayload = ConfigPayload = {}));
|