phonic 0.25.2 → 0.25.4
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 +18 -28
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +3 -1
- package/dist/index.mjs +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,23 +50,23 @@ const phonic = new Phonic("ph_...");
|
|
|
50
50
|
### List agents
|
|
51
51
|
|
|
52
52
|
```ts
|
|
53
|
-
const agentsResult = await phonic.agents.list({ project: "
|
|
53
|
+
const agentsResult = await phonic.agents.list({ project: "main" });
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
### Get agent
|
|
57
57
|
|
|
58
58
|
```ts
|
|
59
|
-
const agentResult = await phonic.agents.get("
|
|
59
|
+
const agentResult = await phonic.agents.get("chris", { project: "main" });
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
### Create agent
|
|
63
63
|
|
|
64
64
|
```ts
|
|
65
65
|
const createAgentResult = await phonic.agents.create({
|
|
66
|
-
name: "
|
|
66
|
+
name: "chris",
|
|
67
67
|
|
|
68
68
|
// Optional fields
|
|
69
|
-
project: "
|
|
69
|
+
project: "main", // Defaults to "main"
|
|
70
70
|
phoneNumber: "assign-automatically", // Defaults to null
|
|
71
71
|
timezone: "Australia/Melbourne", // Defaults to "America/Los_Angeles"
|
|
72
72
|
audioFormat: "mulaw_8000", // Defaults to "pcm_44100". Must be "mulaw_8000" when `phoneNumber` is "assign-automatically"
|
|
@@ -99,11 +99,11 @@ const createAgentResult = await phonic.agents.create({
|
|
|
99
99
|
### Update agent
|
|
100
100
|
|
|
101
101
|
```ts
|
|
102
|
-
const updateAgentResult = await phonic.agents.update("
|
|
103
|
-
name: "
|
|
102
|
+
const updateAgentResult = await phonic.agents.update("chris", {
|
|
103
|
+
name: "chris",
|
|
104
104
|
|
|
105
105
|
// Optional fields
|
|
106
|
-
project: "
|
|
106
|
+
project: "main",
|
|
107
107
|
phoneNumber: "assign-automatically", // or null
|
|
108
108
|
timezone: "Australia/Melbourne",
|
|
109
109
|
voiceId: "sarah",
|
|
@@ -137,10 +137,9 @@ const updateAgentResult = await phonic.agents.update("my-agent", {
|
|
|
137
137
|
|
|
138
138
|
```ts
|
|
139
139
|
const deleteAgentResult = await phonic.agents.delete({
|
|
140
|
-
name: "
|
|
141
|
-
|
|
140
|
+
name: "chris",
|
|
142
141
|
// Optional fields
|
|
143
|
-
project: "
|
|
142
|
+
project: "main",
|
|
144
143
|
});
|
|
145
144
|
```
|
|
146
145
|
|
|
@@ -164,6 +163,7 @@ const toolResult = await phonic.tools.get("next_invoice");
|
|
|
164
163
|
const createToolResult = await phonic.tools.create({
|
|
165
164
|
name: "next_invoice",
|
|
166
165
|
description: "Returns the next invoice of the given user",
|
|
166
|
+
endpointMethod: "POST",
|
|
167
167
|
endpointUrl: "https://myapp.com/webhooks/next-invoice",
|
|
168
168
|
endpointHeaders: {
|
|
169
169
|
Authorization: "Bearer 123"
|
|
@@ -199,6 +199,7 @@ const createToolResult = await phonic.tools.create({
|
|
|
199
199
|
const updateToolResult = await phonic.tools.update("next_invoice", {
|
|
200
200
|
name: "next_invoice_updated",
|
|
201
201
|
description: "Updated description.",
|
|
202
|
+
endpointMethod: "POST",
|
|
202
203
|
endpointUrl: "https://myapp.com/webhooks/next-invoice-updated",
|
|
203
204
|
endpointHeaders: {
|
|
204
205
|
Authorization: "Bearer 456"
|
|
@@ -285,20 +286,11 @@ const conversationResult = await phonic.conversations.getByExternalId({
|
|
|
285
286
|
```ts
|
|
286
287
|
const outboundCallResult = await phonic.conversations.outboundCall("+19189396241", {
|
|
287
288
|
// Optional fields
|
|
288
|
-
|
|
289
|
-
voice_id: "grant",
|
|
290
|
-
welcome_message: "Hi {{customer_name}}. How can I help you today?",
|
|
291
|
-
system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
289
|
+
agent: "chris",
|
|
292
290
|
template_variables: {
|
|
293
291
|
customer_name: "David",
|
|
294
292
|
subject: "Chess"
|
|
295
293
|
},
|
|
296
|
-
enable_silent_audio_fallback: true,
|
|
297
|
-
vad_prebuffer_duration_ms: 1800,
|
|
298
|
-
vad_min_speech_duration_ms: 40,
|
|
299
|
-
vad_min_silence_duration_ms: 550,
|
|
300
|
-
vad_threshold: 0.6,
|
|
301
|
-
tools: ["keypad_input", "natural_conversation_ending"]
|
|
302
294
|
});
|
|
303
295
|
```
|
|
304
296
|
|
|
@@ -317,6 +309,7 @@ const twilioOutboundCallResult = await phonic.conversations.twilio.outboundCall(
|
|
|
317
309
|
},
|
|
318
310
|
{
|
|
319
311
|
// Optional fields
|
|
312
|
+
agent: "chris",
|
|
320
313
|
welcome_message: "Hello, how can I help you?",
|
|
321
314
|
project: "main",
|
|
322
315
|
system_prompt: "You are a helpful assistant.",
|
|
@@ -340,17 +333,14 @@ const phonicWebSocket = phonic.sts.websocket({
|
|
|
340
333
|
input_format: "mulaw_8000",
|
|
341
334
|
|
|
342
335
|
// Optional fields
|
|
343
|
-
|
|
344
|
-
|
|
336
|
+
agent: "chris",
|
|
337
|
+
template_variables: {
|
|
338
|
+
customer_name: "David",
|
|
339
|
+
subject: "Chess"
|
|
340
|
+
},
|
|
345
341
|
welcome_message: "Hello, how can I help you?",
|
|
346
342
|
voice_id: "grant",
|
|
347
343
|
output_format: "mulaw_8000",
|
|
348
|
-
enable_silent_audio_fallback: true,
|
|
349
|
-
vad_prebuffer_duration_ms: 1800,
|
|
350
|
-
vad_min_speech_duration_ms: 40,
|
|
351
|
-
vad_min_silence_duration_ms: 550,
|
|
352
|
-
vad_threshold: 0.6,
|
|
353
|
-
tools: ["keypad_input", "natural_conversation_ending"]
|
|
354
344
|
});
|
|
355
345
|
```
|
|
356
346
|
|
package/dist/index.d.mts
CHANGED
|
@@ -179,15 +179,15 @@ type Agent = {
|
|
|
179
179
|
type ListAgentsParams = {
|
|
180
180
|
project?: string;
|
|
181
181
|
};
|
|
182
|
-
type ListAgentsSuccessResponse =
|
|
182
|
+
type ListAgentsSuccessResponse = {
|
|
183
183
|
agents: Array<Agent>;
|
|
184
|
-
}
|
|
184
|
+
};
|
|
185
185
|
type GetAgentParams = {
|
|
186
186
|
project?: string;
|
|
187
187
|
};
|
|
188
|
-
type GetAgentSuccessResponse =
|
|
188
|
+
type GetAgentSuccessResponse = {
|
|
189
189
|
agent: Agent;
|
|
190
|
-
}
|
|
190
|
+
};
|
|
191
191
|
interface AgentOptionalParams {
|
|
192
192
|
project?: string;
|
|
193
193
|
timezone?: string;
|
|
@@ -384,6 +384,7 @@ type Tool = {
|
|
|
384
384
|
id: string;
|
|
385
385
|
name: string;
|
|
386
386
|
description: string;
|
|
387
|
+
endpoint_method: "POST";
|
|
387
388
|
endpoint_url: string;
|
|
388
389
|
endpoint_headers: Record<string, string>;
|
|
389
390
|
endpoint_timeout_ms: number;
|
|
@@ -398,6 +399,7 @@ type GetToolSuccessResponse = DataOrError<{
|
|
|
398
399
|
type CreateToolParams = {
|
|
399
400
|
name: string;
|
|
400
401
|
description: string;
|
|
402
|
+
endpointMethod: "POST";
|
|
401
403
|
endpointUrl: string;
|
|
402
404
|
endpointHeaders?: Record<string, string>;
|
|
403
405
|
endpointTimeoutMs?: number;
|
|
@@ -410,6 +412,7 @@ type CreateToolSuccessResponse = {
|
|
|
410
412
|
type UpdateToolParams = {
|
|
411
413
|
name?: string;
|
|
412
414
|
description?: string;
|
|
415
|
+
endpointMethod?: "POST";
|
|
413
416
|
endpointUrl?: string;
|
|
414
417
|
endpointHeaders?: Record<string, string>;
|
|
415
418
|
endpointTimeoutMs?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -179,15 +179,15 @@ type Agent = {
|
|
|
179
179
|
type ListAgentsParams = {
|
|
180
180
|
project?: string;
|
|
181
181
|
};
|
|
182
|
-
type ListAgentsSuccessResponse =
|
|
182
|
+
type ListAgentsSuccessResponse = {
|
|
183
183
|
agents: Array<Agent>;
|
|
184
|
-
}
|
|
184
|
+
};
|
|
185
185
|
type GetAgentParams = {
|
|
186
186
|
project?: string;
|
|
187
187
|
};
|
|
188
|
-
type GetAgentSuccessResponse =
|
|
188
|
+
type GetAgentSuccessResponse = {
|
|
189
189
|
agent: Agent;
|
|
190
|
-
}
|
|
190
|
+
};
|
|
191
191
|
interface AgentOptionalParams {
|
|
192
192
|
project?: string;
|
|
193
193
|
timezone?: string;
|
|
@@ -384,6 +384,7 @@ type Tool = {
|
|
|
384
384
|
id: string;
|
|
385
385
|
name: string;
|
|
386
386
|
description: string;
|
|
387
|
+
endpoint_method: "POST";
|
|
387
388
|
endpoint_url: string;
|
|
388
389
|
endpoint_headers: Record<string, string>;
|
|
389
390
|
endpoint_timeout_ms: number;
|
|
@@ -398,6 +399,7 @@ type GetToolSuccessResponse = DataOrError<{
|
|
|
398
399
|
type CreateToolParams = {
|
|
399
400
|
name: string;
|
|
400
401
|
description: string;
|
|
402
|
+
endpointMethod: "POST";
|
|
401
403
|
endpointUrl: string;
|
|
402
404
|
endpointHeaders?: Record<string, string>;
|
|
403
405
|
endpointTimeoutMs?: number;
|
|
@@ -410,6 +412,7 @@ type CreateToolSuccessResponse = {
|
|
|
410
412
|
type UpdateToolParams = {
|
|
411
413
|
name?: string;
|
|
412
414
|
description?: string;
|
|
415
|
+
endpointMethod?: "POST";
|
|
413
416
|
endpointUrl?: string;
|
|
414
417
|
endpointHeaders?: Record<string, string>;
|
|
415
418
|
endpointTimeoutMs?: number;
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(index_exports);
|
|
36
36
|
|
|
37
37
|
// package.json
|
|
38
|
-
var version = "0.25.
|
|
38
|
+
var version = "0.25.4";
|
|
39
39
|
|
|
40
40
|
// src/agents/index.ts
|
|
41
41
|
var Agents = class {
|
|
@@ -383,6 +383,7 @@ var Tools = class {
|
|
|
383
383
|
{
|
|
384
384
|
name: params.name,
|
|
385
385
|
description: params.description,
|
|
386
|
+
endpoint_method: params.endpointMethod,
|
|
386
387
|
endpoint_url: params.endpointUrl,
|
|
387
388
|
endpoint_headers: params.endpointHeaders,
|
|
388
389
|
endpoint_timeout_ms: params.endpointTimeoutMs,
|
|
@@ -397,6 +398,7 @@ var Tools = class {
|
|
|
397
398
|
{
|
|
398
399
|
name: params.name,
|
|
399
400
|
description: params.description,
|
|
401
|
+
endpoint_method: params.endpointMethod,
|
|
400
402
|
endpoint_url: params.endpointUrl,
|
|
401
403
|
endpoint_headers: params.endpointHeaders,
|
|
402
404
|
endpoint_timeout_ms: params.endpointTimeoutMs,
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.25.
|
|
2
|
+
var version = "0.25.4";
|
|
3
3
|
|
|
4
4
|
// src/agents/index.ts
|
|
5
5
|
var Agents = class {
|
|
@@ -347,6 +347,7 @@ var Tools = class {
|
|
|
347
347
|
{
|
|
348
348
|
name: params.name,
|
|
349
349
|
description: params.description,
|
|
350
|
+
endpoint_method: params.endpointMethod,
|
|
350
351
|
endpoint_url: params.endpointUrl,
|
|
351
352
|
endpoint_headers: params.endpointHeaders,
|
|
352
353
|
endpoint_timeout_ms: params.endpointTimeoutMs,
|
|
@@ -361,6 +362,7 @@ var Tools = class {
|
|
|
361
362
|
{
|
|
362
363
|
name: params.name,
|
|
363
364
|
description: params.description,
|
|
365
|
+
endpoint_method: params.endpointMethod,
|
|
364
366
|
endpoint_url: params.endpointUrl,
|
|
365
367
|
endpoint_headers: params.endpointHeaders,
|
|
366
368
|
endpoint_timeout_ms: params.endpointTimeoutMs,
|