phonic 0.29.0 → 0.29.2

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 CHANGED
@@ -80,6 +80,7 @@ const result = await phonic.agents.create({
80
80
  timezone: "Australia/Melbourne", // Defaults to "America/Los_Angeles"
81
81
  audioFormat: "mulaw_8000", // Defaults to "pcm_44100". Must be "mulaw_8000" when `phoneNumber` is "assign-automatically"
82
82
  voiceId: "sarah", // Defaults to "grant"
83
+ audioSpeed: 1.1, // Defaults to 1.0. Must be between 0.5 and 1.5, multiple of 0.1
83
84
  welcomeMessage: "Hello, how can I help you?", // Defaults to ""
84
85
  systemPrompt: "You are an expert in {{subject}}. Be kind to {{user_name}}.", // Defaults to "Respond in 1-2 sentences."
85
86
  templateVariables: {
@@ -117,6 +118,7 @@ const result = await phonic.agents.update("chris", {
117
118
  timezone: "Australia/Melbourne",
118
119
  voiceId: "sarah",
119
120
  audioFormat: "mulaw_8000", // Must be "mulaw_8000" when `phoneNumber` is "assign-automatically"
121
+ audioSpeed: 1.1, // Must be between 0.5 and 1.5, multiple of 0.1
120
122
  welcomeMessage: "Hello, how can I help you?",
121
123
  systemPrompt: "You are an expert in {{subject}}. Be kind to {{user_name}}.",
122
124
  templateVariables: {
@@ -154,6 +156,7 @@ const result = await phonic.agents.upsert({
154
156
  timezone: "Australia/Melbourne",
155
157
  voiceId: "sarah",
156
158
  audioFormat: "mulaw_8000", // Must be "mulaw_8000" when `phoneNumber` is "assign-automatically"
159
+ audioSpeed: 1.1, // Defaults to 1.0. Must be between 0.5 and 1.5, multiple of 0.1
157
160
  welcomeMessage: "Hello, how can I help you?",
158
161
  systemPrompt: "You are an expert in {{subject}}. Be kind to {{user_name}}.",
159
162
  templateVariables: {
package/dist/index.d.mts CHANGED
@@ -36,13 +36,86 @@ type DataOrError<T> = Promise<{
36
36
  };
37
37
  }>;
38
38
  type ISODate = `${string}-${string}-${string}`;
39
- type ISODateTime$1 = `${string}Z`;
39
+ type ISODateTime = `${string}Z`;
40
+ type TaskStatus = "pending" | "completed" | "failed";
41
+ type TaskResult = {
42
+ name: string;
43
+ description: string;
44
+ status: TaskStatus;
45
+ commentary: string | null;
46
+ };
47
+ type TaskResults = {
48
+ results: Array<TaskResult>;
49
+ };
50
+ type ConversationItem = {
51
+ role: "user";
52
+ item_idx: number;
53
+ text: string;
54
+ duration_ms: number;
55
+ started_at: string;
56
+ } | {
57
+ role: "assistant";
58
+ item_idx: number;
59
+ text: string;
60
+ voice_id: string;
61
+ system_prompt: string;
62
+ audio_speed: number;
63
+ duration_ms: number;
64
+ started_at: string;
65
+ };
66
+ type Conversation = {
67
+ id: string;
68
+ external_id: string | null;
69
+ workspace: string;
70
+ agent: {
71
+ id: string;
72
+ name: string;
73
+ } | null;
74
+ model: string;
75
+ welcome_message: string | null;
76
+ input_format: "pcm_44100" | "mulaw_8000";
77
+ output_format: "pcm_44100" | "mulaw_8000";
78
+ live_transcript: string;
79
+ post_call_transcript: string | null;
80
+ audio_url: string | null;
81
+ duration_ms: number;
82
+ task_results: TaskResults;
83
+ started_at: ISODateTime;
84
+ ended_at: ISODateTime | null;
85
+ items: Array<ConversationItem>;
86
+ };
87
+ type ConversationEndedWebhookPayload = {
88
+ event_type: "conversation.ended";
89
+ created_at: ISODateTime;
90
+ data: {
91
+ conversation: Conversation;
92
+ call_info: {
93
+ from_phone_number: string;
94
+ to_phone_number: string;
95
+ } | null;
96
+ };
97
+ };
98
+ type ConversationAnalysisWebhookPayload = {
99
+ event_type: "conversation.analysis";
100
+ created_at: ISODateTime;
101
+ data: {
102
+ conversation: {
103
+ latencies_ms: number[];
104
+ interruptions_count: number;
105
+ };
106
+ call_info: {
107
+ from_phone_number: string;
108
+ to_phone_number: string;
109
+ } | null;
110
+ };
111
+ };
40
112
 
41
113
  type PhonicSTSTool = "keypad_input" | "natural_conversation_ending" | (string & {});
42
114
  interface PhonicSTSConfigBase {
43
115
  input_format: "pcm_44100" | "mulaw_8000";
44
116
  output_format?: "pcm_44100" | "mulaw_8000";
45
117
  voice_id?: string;
118
+ audio_speed?: number;
46
119
  welcome_message?: string;
47
120
  system_prompt?: string;
48
121
  template_variables?: Record<string, string>;
@@ -203,6 +276,7 @@ interface AgentOptionalParams {
203
276
  project?: string;
204
277
  timezone?: string;
205
278
  voiceId?: string;
279
+ audioSpeed?: number;
206
280
  welcomeMessage?: string;
207
281
  systemPrompt?: string;
208
282
  templateVariables?: Record<string, {
@@ -291,36 +365,6 @@ declare class Agents {
291
365
  delete(nameOrId: string, params?: DeleteAgentParams): DataOrError<DeleteAgentSuccessResponse>;
292
366
  }
293
367
 
294
- type ISODateTime = `${string}Z`;
295
- type ConversationItem = {
296
- role: "user";
297
- item_idx: number;
298
- text: string;
299
- duration_ms: number;
300
- started_at: string;
301
- } | {
302
- role: "assistant";
303
- item_idx: number;
304
- text: string;
305
- voice_id: string;
306
- system_prompt: string;
307
- audio_speed: number;
308
- duration_ms: number;
309
- started_at: string;
310
- };
311
- type Conversation = {
312
- id: string;
313
- external_id: string | null;
314
- model: string;
315
- welcome_message: string | null;
316
- input_format: "pcm_44100" | "mulaw_8000";
317
- output_format: "pcm_44100" | "mulaw_8000";
318
- text: string;
319
- duration_ms: number;
320
- started_at: ISODateTime;
321
- ended_at: ISODateTime;
322
- items: Array<ConversationItem>;
323
- };
324
368
  type ConversationSuccessResponse = {
325
369
  conversation: Conversation;
326
370
  };
@@ -358,8 +402,8 @@ declare class Conversations {
358
402
  project?: string;
359
403
  durationMin?: number;
360
404
  durationMax?: number;
361
- startedAtMin?: ISODate | ISODateTime$1;
362
- startedAtMax?: ISODate | ISODateTime$1;
405
+ startedAtMin?: ISODate | ISODateTime;
406
+ startedAtMax?: ISODate | ISODateTime;
363
407
  }): DataOrError<ConversationsSuccessResponse>;
364
408
  get(id: string): DataOrError<ConversationSuccessResponse>;
365
409
  getByExternalId({ project, externalId, }: {
@@ -639,4 +683,4 @@ declare class Phonic {
639
683
  }>;
640
684
  }
641
685
 
642
- export { Phonic, type PhonicConfigurationEndpointRequestPayload, type PhonicConfigurationEndpointResponsePayload, type PhonicSTSConfig, PhonicSTSWebSocket, type PhonicSTSWebSocketResponseMessage };
686
+ export { type ConversationAnalysisWebhookPayload, type ConversationEndedWebhookPayload, Phonic, type PhonicConfigurationEndpointRequestPayload, type PhonicConfigurationEndpointResponsePayload, type PhonicSTSConfig, PhonicSTSWebSocket, type PhonicSTSWebSocketResponseMessage };
package/dist/index.d.ts CHANGED
@@ -36,13 +36,86 @@ type DataOrError<T> = Promise<{
36
36
  };
37
37
  }>;
38
38
  type ISODate = `${string}-${string}-${string}`;
39
- type ISODateTime$1 = `${string}Z`;
39
+ type ISODateTime = `${string}Z`;
40
+ type TaskStatus = "pending" | "completed" | "failed";
41
+ type TaskResult = {
42
+ name: string;
43
+ description: string;
44
+ status: TaskStatus;
45
+ commentary: string | null;
46
+ };
47
+ type TaskResults = {
48
+ results: Array<TaskResult>;
49
+ };
50
+ type ConversationItem = {
51
+ role: "user";
52
+ item_idx: number;
53
+ text: string;
54
+ duration_ms: number;
55
+ started_at: string;
56
+ } | {
57
+ role: "assistant";
58
+ item_idx: number;
59
+ text: string;
60
+ voice_id: string;
61
+ system_prompt: string;
62
+ audio_speed: number;
63
+ duration_ms: number;
64
+ started_at: string;
65
+ };
66
+ type Conversation = {
67
+ id: string;
68
+ external_id: string | null;
69
+ workspace: string;
70
+ agent: {
71
+ id: string;
72
+ name: string;
73
+ } | null;
74
+ model: string;
75
+ welcome_message: string | null;
76
+ input_format: "pcm_44100" | "mulaw_8000";
77
+ output_format: "pcm_44100" | "mulaw_8000";
78
+ live_transcript: string;
79
+ post_call_transcript: string | null;
80
+ audio_url: string | null;
81
+ duration_ms: number;
82
+ task_results: TaskResults;
83
+ started_at: ISODateTime;
84
+ ended_at: ISODateTime | null;
85
+ items: Array<ConversationItem>;
86
+ };
87
+ type ConversationEndedWebhookPayload = {
88
+ event_type: "conversation.ended";
89
+ created_at: ISODateTime;
90
+ data: {
91
+ conversation: Conversation;
92
+ call_info: {
93
+ from_phone_number: string;
94
+ to_phone_number: string;
95
+ } | null;
96
+ };
97
+ };
98
+ type ConversationAnalysisWebhookPayload = {
99
+ event_type: "conversation.analysis";
100
+ created_at: ISODateTime;
101
+ data: {
102
+ conversation: {
103
+ latencies_ms: number[];
104
+ interruptions_count: number;
105
+ };
106
+ call_info: {
107
+ from_phone_number: string;
108
+ to_phone_number: string;
109
+ } | null;
110
+ };
111
+ };
40
112
 
41
113
  type PhonicSTSTool = "keypad_input" | "natural_conversation_ending" | (string & {});
42
114
  interface PhonicSTSConfigBase {
43
115
  input_format: "pcm_44100" | "mulaw_8000";
44
116
  output_format?: "pcm_44100" | "mulaw_8000";
45
117
  voice_id?: string;
118
+ audio_speed?: number;
46
119
  welcome_message?: string;
47
120
  system_prompt?: string;
48
121
  template_variables?: Record<string, string>;
@@ -203,6 +276,7 @@ interface AgentOptionalParams {
203
276
  project?: string;
204
277
  timezone?: string;
205
278
  voiceId?: string;
279
+ audioSpeed?: number;
206
280
  welcomeMessage?: string;
207
281
  systemPrompt?: string;
208
282
  templateVariables?: Record<string, {
@@ -291,36 +365,6 @@ declare class Agents {
291
365
  delete(nameOrId: string, params?: DeleteAgentParams): DataOrError<DeleteAgentSuccessResponse>;
292
366
  }
293
367
 
294
- type ISODateTime = `${string}Z`;
295
- type ConversationItem = {
296
- role: "user";
297
- item_idx: number;
298
- text: string;
299
- duration_ms: number;
300
- started_at: string;
301
- } | {
302
- role: "assistant";
303
- item_idx: number;
304
- text: string;
305
- voice_id: string;
306
- system_prompt: string;
307
- audio_speed: number;
308
- duration_ms: number;
309
- started_at: string;
310
- };
311
- type Conversation = {
312
- id: string;
313
- external_id: string | null;
314
- model: string;
315
- welcome_message: string | null;
316
- input_format: "pcm_44100" | "mulaw_8000";
317
- output_format: "pcm_44100" | "mulaw_8000";
318
- text: string;
319
- duration_ms: number;
320
- started_at: ISODateTime;
321
- ended_at: ISODateTime;
322
- items: Array<ConversationItem>;
323
- };
324
368
  type ConversationSuccessResponse = {
325
369
  conversation: Conversation;
326
370
  };
@@ -358,8 +402,8 @@ declare class Conversations {
358
402
  project?: string;
359
403
  durationMin?: number;
360
404
  durationMax?: number;
361
- startedAtMin?: ISODate | ISODateTime$1;
362
- startedAtMax?: ISODate | ISODateTime$1;
405
+ startedAtMin?: ISODate | ISODateTime;
406
+ startedAtMax?: ISODate | ISODateTime;
363
407
  }): DataOrError<ConversationsSuccessResponse>;
364
408
  get(id: string): DataOrError<ConversationSuccessResponse>;
365
409
  getByExternalId({ project, externalId, }: {
@@ -639,4 +683,4 @@ declare class Phonic {
639
683
  }>;
640
684
  }
641
685
 
642
- export { Phonic, type PhonicConfigurationEndpointRequestPayload, type PhonicConfigurationEndpointResponsePayload, type PhonicSTSConfig, PhonicSTSWebSocket, type PhonicSTSWebSocketResponseMessage };
686
+ export { type ConversationAnalysisWebhookPayload, type ConversationEndedWebhookPayload, Phonic, type PhonicConfigurationEndpointRequestPayload, type PhonicConfigurationEndpointResponsePayload, type PhonicSTSConfig, PhonicSTSWebSocket, type PhonicSTSWebSocketResponseMessage };
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.29.0";
38
+ var version = "0.29.2";
39
39
 
40
40
  // src/agents/index.ts
41
41
  var Agents = class {
@@ -92,6 +92,7 @@ var Agents = class {
92
92
  phone_number: params.phoneNumber,
93
93
  timezone: params.timezone,
94
94
  audio_format: params.phoneNumber === "assign-automatically" ? "mulaw_8000" : params.audioFormat,
95
+ audio_speed: params.audioSpeed,
95
96
  voice_id: params.voiceId,
96
97
  welcome_message: params.welcomeMessage,
97
98
  system_prompt: params.systemPrompt,
@@ -119,6 +120,7 @@ var Agents = class {
119
120
  timezone: params.timezone,
120
121
  audio_format: params.phoneNumber === "assign-automatically" ? "mulaw_8000" : params.audioFormat,
121
122
  voice_id: params.voiceId,
123
+ audio_speed: params.audioSpeed,
122
124
  welcome_message: params.welcomeMessage,
123
125
  system_prompt: params.systemPrompt,
124
126
  template_variables: this.getTemplateVariablesForBody(
@@ -147,6 +149,7 @@ var Agents = class {
147
149
  voice_id: params.voiceId,
148
150
  welcome_message: params.welcomeMessage,
149
151
  system_prompt: params.systemPrompt,
152
+ audio_speed: params.audioSpeed,
150
153
  template_variables: this.getTemplateVariablesForBody(
151
154
  params.templateVariables
152
155
  ),
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.29.0";
2
+ var version = "0.29.2";
3
3
 
4
4
  // src/agents/index.ts
5
5
  var Agents = class {
@@ -56,6 +56,7 @@ var Agents = class {
56
56
  phone_number: params.phoneNumber,
57
57
  timezone: params.timezone,
58
58
  audio_format: params.phoneNumber === "assign-automatically" ? "mulaw_8000" : params.audioFormat,
59
+ audio_speed: params.audioSpeed,
59
60
  voice_id: params.voiceId,
60
61
  welcome_message: params.welcomeMessage,
61
62
  system_prompt: params.systemPrompt,
@@ -83,6 +84,7 @@ var Agents = class {
83
84
  timezone: params.timezone,
84
85
  audio_format: params.phoneNumber === "assign-automatically" ? "mulaw_8000" : params.audioFormat,
85
86
  voice_id: params.voiceId,
87
+ audio_speed: params.audioSpeed,
86
88
  welcome_message: params.welcomeMessage,
87
89
  system_prompt: params.systemPrompt,
88
90
  template_variables: this.getTemplateVariablesForBody(
@@ -111,6 +113,7 @@ var Agents = class {
111
113
  voice_id: params.voiceId,
112
114
  welcome_message: params.welcomeMessage,
113
115
  system_prompt: params.systemPrompt,
116
+ audio_speed: params.audioSpeed,
114
117
  template_variables: this.getTemplateVariablesForBody(
115
118
  params.templateVariables
116
119
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.29.0",
3
+ "version": "0.29.2",
4
4
  "description": "Phonic Node.js SDK",
5
5
  "scripts": {
6
6
  "build": "tsup",