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.
Files changed (79) hide show
  1. package/README.md +4 -1
  2. package/dist/cjs/Client.js +2 -2
  3. package/dist/cjs/api/resources/agents/client/Client.d.ts +13 -4
  4. package/dist/cjs/api/resources/agents/client/Client.js +15 -8
  5. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +9 -4
  6. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +14 -6
  7. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +2 -0
  8. package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +4 -1
  9. package/dist/cjs/api/resources/conversations/client/Client.d.ts +2 -1
  10. package/dist/cjs/api/resources/conversations/client/Client.js +4 -5
  11. package/dist/cjs/api/resources/conversations/client/Socket.d.ts +1 -1
  12. package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +1 -0
  13. package/dist/cjs/api/resources/extractionSchemas/client/Client.d.ts +1 -1
  14. package/dist/cjs/api/resources/extractionSchemas/client/Client.js +3 -5
  15. package/dist/cjs/api/resources/projects/client/Client.d.ts +1 -1
  16. package/dist/cjs/api/resources/projects/client/Client.js +3 -5
  17. package/dist/cjs/api/resources/projects/client/requests/UpdateProjectRequest.d.ts +1 -1
  18. package/dist/cjs/api/resources/tools/client/Client.d.ts +1 -1
  19. package/dist/cjs/api/resources/tools/client/Client.js +3 -5
  20. package/dist/cjs/api/resources/voices/client/Client.d.ts +1 -1
  21. package/dist/cjs/api/resources/voices/client/Client.js +3 -5
  22. package/dist/cjs/api/types/Agent.d.ts +10 -6
  23. package/dist/cjs/api/types/Agent.js +2 -0
  24. package/dist/cjs/api/types/ConfigPayload.d.ts +10 -4
  25. package/dist/cjs/api/types/ConfigPayload.js +4 -0
  26. package/dist/cjs/api/types/Conversation.d.ts +19 -6
  27. package/dist/cjs/api/types/Conversation.js +11 -0
  28. package/dist/cjs/api/types/ConversationExtraction.d.ts +1 -1
  29. package/dist/cjs/api/types/ConversationItem.d.ts +13 -13
  30. package/dist/cjs/api/types/CreateAgentRequest.d.ts +10 -5
  31. package/dist/cjs/api/types/CreateAgentRequest.js +2 -0
  32. package/dist/cjs/api/types/ExtractionField.d.ts +1 -1
  33. package/dist/cjs/api/types/InputTextPayload.d.ts +2 -0
  34. package/dist/cjs/api/types/OutboundCallConfig.d.ts +4 -2
  35. package/dist/cjs/api/types/Project.d.ts +1 -1
  36. package/dist/cjs/api/types/ToolCallOutputProcessedPayload.d.ts +8 -8
  37. package/dist/cjs/api/types/Voice.d.ts +1 -1
  38. package/dist/cjs/version.d.ts +1 -1
  39. package/dist/cjs/version.js +1 -1
  40. package/dist/esm/Client.mjs +2 -2
  41. package/dist/esm/api/resources/agents/client/Client.d.mts +13 -4
  42. package/dist/esm/api/resources/agents/client/Client.mjs +15 -8
  43. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +9 -4
  44. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +14 -6
  45. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.mjs +2 -0
  46. package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +4 -1
  47. package/dist/esm/api/resources/conversations/client/Client.d.mts +2 -1
  48. package/dist/esm/api/resources/conversations/client/Client.mjs +4 -5
  49. package/dist/esm/api/resources/conversations/client/Socket.d.mts +1 -1
  50. package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +1 -0
  51. package/dist/esm/api/resources/extractionSchemas/client/Client.d.mts +1 -1
  52. package/dist/esm/api/resources/extractionSchemas/client/Client.mjs +3 -5
  53. package/dist/esm/api/resources/projects/client/Client.d.mts +1 -1
  54. package/dist/esm/api/resources/projects/client/Client.mjs +3 -5
  55. package/dist/esm/api/resources/projects/client/requests/UpdateProjectRequest.d.mts +1 -1
  56. package/dist/esm/api/resources/tools/client/Client.d.mts +1 -1
  57. package/dist/esm/api/resources/tools/client/Client.mjs +3 -5
  58. package/dist/esm/api/resources/voices/client/Client.d.mts +1 -1
  59. package/dist/esm/api/resources/voices/client/Client.mjs +3 -5
  60. package/dist/esm/api/types/Agent.d.mts +10 -6
  61. package/dist/esm/api/types/Agent.mjs +2 -0
  62. package/dist/esm/api/types/ConfigPayload.d.mts +10 -4
  63. package/dist/esm/api/types/ConfigPayload.mjs +4 -0
  64. package/dist/esm/api/types/Conversation.d.mts +19 -6
  65. package/dist/esm/api/types/Conversation.mjs +10 -1
  66. package/dist/esm/api/types/ConversationExtraction.d.mts +1 -1
  67. package/dist/esm/api/types/ConversationItem.d.mts +13 -13
  68. package/dist/esm/api/types/CreateAgentRequest.d.mts +10 -5
  69. package/dist/esm/api/types/CreateAgentRequest.mjs +2 -0
  70. package/dist/esm/api/types/ExtractionField.d.mts +1 -1
  71. package/dist/esm/api/types/InputTextPayload.d.mts +2 -0
  72. package/dist/esm/api/types/OutboundCallConfig.d.mts +4 -2
  73. package/dist/esm/api/types/Project.d.mts +1 -1
  74. package/dist/esm/api/types/ToolCallOutputProcessedPayload.d.mts +8 -8
  75. package/dist/esm/api/types/Voice.d.mts +1 -1
  76. package/dist/esm/version.d.mts +1 -1
  77. package/dist/esm/version.mjs +1 -1
  78. package/package.json +2 -2
  79. package/reference.md +13 -3
@@ -18,6 +18,7 @@ import * as Phonic from "../../../../index.mjs";
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
  }
@@ -425,12 +425,10 @@ export class ExtractionSchemas {
425
425
  return __awaiter(this, void 0, void 0, function* () {
426
426
  var _a;
427
427
  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"];
428
- if (bearer == null) {
429
- throw new errors.PhonicError({
430
- message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
431
- });
428
+ if (bearer != null) {
429
+ return `Bearer ${bearer}`;
432
430
  }
433
- return `Bearer ${bearer}`;
431
+ return undefined;
434
432
  });
435
433
  }
436
434
  }
@@ -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
  }
@@ -536,12 +536,10 @@ export class Projects {
536
536
  return __awaiter(this, void 0, void 0, function* () {
537
537
  var _a;
538
538
  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"];
539
- if (bearer == null) {
540
- throw new errors.PhonicError({
541
- message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
542
- });
539
+ if (bearer != null) {
540
+ return `Bearer ${bearer}`;
543
541
  }
544
- return `Bearer ${bearer}`;
542
+ return undefined;
545
543
  });
546
544
  }
547
545
  }
@@ -11,5 +11,5 @@
11
11
  export interface UpdateProjectRequest {
12
12
  /** The name of the project. Can only contain lowercase letters, numbers and hyphens. Must be unique within the workspace. */
13
13
  name?: string;
14
- default_agent?: string;
14
+ default_agent?: string | null;
15
15
  }
@@ -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
  }
@@ -446,12 +446,10 @@ export class Tools {
446
446
  return __awaiter(this, void 0, void 0, function* () {
447
447
  var _a;
448
448
  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"];
449
- if (bearer == null) {
450
- throw new errors.PhonicError({
451
- message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
452
- });
449
+ if (bearer != null) {
450
+ return `Bearer ${bearer}`;
453
451
  }
454
- return `Bearer ${bearer}`;
452
+ return undefined;
455
453
  });
456
454
  }
457
455
  }
@@ -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
  }
@@ -157,12 +157,10 @@ export class Voices {
157
157
  return __awaiter(this, void 0, void 0, function* () {
158
158
  var _a;
159
159
  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"];
160
- if (bearer == null) {
161
- throw new errors.PhonicError({
162
- message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
163
- });
160
+ if (bearer != null) {
161
+ return `Bearer ${bearer}`;
164
162
  }
165
- return `Bearer ${bearer}`;
163
+ return undefined;
166
164
  });
167
165
  }
168
166
  }
@@ -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?: string;
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?: string;
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?: number;
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?: Agent.ConfigurationEndpoint;
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?: string;
67
+ default_value: string | null;
64
68
  }
65
69
  }
66
70
  type Tools = Tools.Item[];
@@ -5,6 +5,8 @@ export var Agent;
5
5
  (function (Agent) {
6
6
  Agent.AudioFormat = {
7
7
  Pcm44100: "pcm_44100",
8
+ Pcm16000: "pcm_16000",
9
+ Pcm8000: "pcm_8000",
8
10
  Mulaw8000: "mulaw_8000",
9
11
  };
10
12
  })(Agent || (Agent = {}));
@@ -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
  }
@@ -5,10 +5,14 @@ export var ConfigPayload;
5
5
  (function (ConfigPayload) {
6
6
  ConfigPayload.InputFormat = {
7
7
  Pcm44100: "pcm_44100",
8
+ Pcm16000: "pcm_16000",
9
+ Pcm8000: "pcm_8000",
8
10
  Mulaw8000: "mulaw_8000",
9
11
  };
10
12
  ConfigPayload.OutputFormat = {
11
13
  Pcm44100: "pcm_44100",
14
+ Pcm16000: "pcm_16000",
15
+ Pcm8000: "pcm_8000",
12
16
  Mulaw8000: "mulaw_8000",
13
17
  };
14
18
  })(ConfigPayload || (ConfigPayload = {}));
@@ -6,17 +6,17 @@ export interface Conversation {
6
6
  /** The conversation ID. */
7
7
  id: string;
8
8
  /** The agent associated with the conversation. */
9
- agent?: Conversation.Agent;
9
+ agent: Conversation.Agent | null;
10
10
  /** The organization/workspace name. */
11
11
  workspace: string;
12
12
  /** The project associated with the conversation. */
13
13
  project: Conversation.Project;
14
14
  /** External ID for conversation tracking. */
15
- external_id?: string;
15
+ external_id: string | null;
16
16
  /** The STS model used. */
17
17
  model: string;
18
18
  /** Welcome message played at start. */
19
- welcome_message?: string;
19
+ welcome_message: string | null;
20
20
  /** Template variables used in the conversation. */
21
21
  template_variables: Record<string, string>;
22
22
  /** Audio input format. */
@@ -28,15 +28,17 @@ export interface Conversation {
28
28
  /** Live transcript of the conversation. */
29
29
  live_transcript: string;
30
30
  /** Post-call processed transcript. */
31
- post_call_transcript?: string;
31
+ post_call_transcript: string | null;
32
32
  /** Duration of the conversation in milliseconds. */
33
33
  duration_ms: number;
34
34
  /** Presigned URL to the conversation audio file. */
35
- audio_url?: string;
35
+ audio_url: string | null;
36
36
  /** When the conversation started. */
37
37
  started_at: string;
38
38
  /** When the conversation ended. */
39
- ended_at?: string;
39
+ ended_at: string | null;
40
+ /** Who or what ended the conversation. */
41
+ ended_by: Conversation.EndedBy | null;
40
42
  /** Array of conversation items (turns). */
41
43
  items: Phonic.ConversationItem[];
42
44
  /** Results from conversation evaluations and extractions. */
@@ -63,4 +65,15 @@ export declare namespace Conversation {
63
65
  /** The name of the project. */
64
66
  name: string;
65
67
  }
68
+ /**
69
+ * Who or what ended the conversation.
70
+ */
71
+ type EndedBy = "user" | "user_canceled" | "user_validation_failed" | "assistant" | "error";
72
+ const EndedBy: {
73
+ readonly User: "user";
74
+ readonly UserCanceled: "user_canceled";
75
+ readonly UserValidationFailed: "user_validation_failed";
76
+ readonly Assistant: "assistant";
77
+ readonly Error: "error";
78
+ };
66
79
  }
@@ -1,4 +1,13 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export {};
4
+ export var Conversation;
5
+ (function (Conversation) {
6
+ Conversation.EndedBy = {
7
+ User: "user",
8
+ UserCanceled: "user_canceled",
9
+ UserValidationFailed: "user_validation_failed",
10
+ Assistant: "assistant",
11
+ Error: "error",
12
+ };
13
+ })(Conversation || (Conversation = {}));
@@ -10,7 +10,7 @@ export interface ConversationExtraction {
10
10
  /** The extracted data. */
11
11
  result: Record<string, unknown>;
12
12
  /** Error message if extraction failed. */
13
- error?: string;
13
+ error: string | null;
14
14
  /** When the extraction was created. */
15
15
  created_at: string;
16
16
  }
@@ -9,7 +9,7 @@ export interface ConversationItem {
9
9
  /** Live transcript of this turn. */
10
10
  live_transcript: string;
11
11
  /** Post-call processed transcript. */
12
- post_call_transcript?: string;
12
+ post_call_transcript: string | null;
13
13
  /** Duration of this turn in milliseconds. */
14
14
  duration_ms: number;
15
15
  /** When this turn started. */
@@ -39,29 +39,29 @@ export declare namespace ConversationItem {
39
39
  id: string;
40
40
  tool: Item.Tool;
41
41
  /** HTTP method for webhook tool calls. */
42
- endpoint_method?: string;
42
+ endpoint_method?: string | null;
43
43
  /** URL for webhook tool calls. */
44
- endpoint_url?: string;
44
+ endpoint_url?: string | null;
45
45
  /** Headers for webhook tool calls. */
46
- endpoint_headers?: Record<string, string | undefined>;
46
+ endpoint_headers?: Record<string, string | null> | null;
47
47
  /** Timeout in milliseconds for webhook tool calls. */
48
- endpoint_timeout_ms?: number;
48
+ endpoint_timeout_ms?: number | null;
49
49
  /** When the webhook endpoint was called (null on error). */
50
- endpoint_called_at?: string;
50
+ endpoint_called_at?: string | null;
51
51
  /** Query parameters for webhook tool calls (null on error or when no params). */
52
- query_params?: Record<string, unknown>;
52
+ query_params?: Record<string, unknown> | null;
53
53
  /** HTTP response status code for webhook tool calls (null on error). */
54
- response_status_code?: number;
54
+ response_status_code?: number | null;
55
55
  /** Timeout in milliseconds for websocket tool calls. */
56
- tool_call_output_timeout_ms?: number;
56
+ tool_call_output_timeout_ms?: number | null;
57
57
  /** The request body sent to the tool. */
58
- request_body?: Record<string, unknown>;
58
+ request_body: Record<string, unknown> | null;
59
59
  /** The response body received from the tool. */
60
- response_body?: Record<string, unknown>;
60
+ response_body: Record<string, unknown> | null;
61
61
  /** Whether the tool call timed out. */
62
- timed_out?: boolean;
62
+ timed_out: boolean | null;
63
63
  /** Error message if the tool call failed. */
64
- error_message?: string;
64
+ error_message: string | null;
65
65
  }
66
66
  namespace Item {
67
67
  interface Tool {
@@ -5,7 +5,7 @@ import * as Phonic from "../index.mjs";
5
5
  export interface CreateAgentRequest {
6
6
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
7
7
  name: string;
8
- phone_number?: "assign-automatically";
8
+ phone_number?: "assign-automatically" | null;
9
9
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
10
10
  timezone?: string;
11
11
  /** The voice ID to use. */
@@ -27,28 +27,33 @@ export interface CreateAgentRequest {
27
27
  /** Array of task objects with `name` and `description` fields. */
28
28
  tasks?: Phonic.Task[];
29
29
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
30
- no_input_poke_sec?: number;
30
+ no_input_poke_sec?: number | null;
31
31
  /** The message to send after the specified silence. */
32
32
  no_input_poke_text?: string;
33
33
  /** Seconds of silence before ending the conversation. */
34
34
  no_input_end_conversation_sec?: number;
35
+ /** Array of ISO 639-1 language codes that the agent should be able to recognize */
36
+ recognized_languages?: string[];
35
37
  /** These words, or short phrases, will be more accurately recognized by the agent. */
36
38
  boosted_keywords?: string[];
37
39
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint when to get configuration options. */
38
- configuration_endpoint?: CreateAgentRequest.ConfigurationEndpoint;
40
+ configuration_endpoint?: CreateAgentRequest.ConfigurationEndpoint | null;
39
41
  }
40
42
  export declare namespace CreateAgentRequest {
41
43
  /**
42
44
  * The audio format of the agent.
43
45
  */
44
- type AudioFormat = "pcm_44100" | "mulaw_8000";
46
+ type AudioFormat = "pcm_44100" | "pcm_16000" | "pcm_8000" | "mulaw_8000";
45
47
  const AudioFormat: {
46
48
  readonly Pcm44100: "pcm_44100";
49
+ readonly Pcm16000: "pcm_16000";
50
+ readonly Pcm8000: "pcm_8000";
47
51
  readonly Mulaw8000: "mulaw_8000";
48
52
  };
49
53
  namespace TemplateVariables {
50
54
  interface Value {
51
- default_value?: string;
55
+ default_value: string | null;
56
+ is_boosted_keyword?: boolean;
52
57
  }
53
58
  }
54
59
  type Tools = Tools.Item[];
@@ -5,6 +5,8 @@ export var CreateAgentRequest;
5
5
  (function (CreateAgentRequest) {
6
6
  CreateAgentRequest.AudioFormat = {
7
7
  Pcm44100: "pcm_44100",
8
+ Pcm16000: "pcm_16000",
9
+ Pcm8000: "pcm_8000",
8
10
  Mulaw8000: "mulaw_8000",
9
11
  };
10
12
  })(CreateAgentRequest || (CreateAgentRequest = {}));
@@ -7,7 +7,7 @@ export interface ExtractionField {
7
7
  /** The field type. */
8
8
  type: ExtractionField.Type;
9
9
  /** Description of the field. */
10
- description?: string;
10
+ description?: string | null;
11
11
  }
12
12
  export declare namespace ExtractionField {
13
13
  /**
@@ -3,6 +3,8 @@
3
3
  */
4
4
  export interface InputTextPayload {
5
5
  type: "input_text";
6
+ /** Detected ISO 639-1 language code of user speech */
7
+ language: string;
6
8
  /** Transcribed user speech */
7
9
  text: string;
8
10
  }
@@ -10,7 +10,7 @@ export interface OutboundCallConfig {
10
10
  /** The name of the project to use for the call. */
11
11
  project?: string;
12
12
  /** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. */
13
- welcome_message?: string;
13
+ welcome_message?: string | null;
14
14
  /** Instructions for the conversation. Can contain template variables like `{{subject}}`. */
15
15
  system_prompt?: string;
16
16
  /** Variables that can be used in the welcome message and the system prompt. */
@@ -18,11 +18,13 @@ export interface OutboundCallConfig {
18
18
  /** The voice ID to use for the agent. */
19
19
  voice_id?: string;
20
20
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
21
- no_input_poke_sec?: number;
21
+ no_input_poke_sec?: number | null;
22
22
  /** The message to send after the specified silence. */
23
23
  no_input_poke_text?: string;
24
24
  /** Seconds of silence before ending the conversation. */
25
25
  no_input_end_conversation_sec?: number;
26
+ /** Array of ISO 639-1 language codes that the agent should be able to recognize */
27
+ recognized_languages?: string[];
26
28
  /** These words, or short phrases, will be more accurately recognized by the agent. */
27
29
  boosted_keywords?: string[];
28
30
  /** Array of built-in or custom tool names to use. */
@@ -7,7 +7,7 @@ export interface Project {
7
7
  /** The name of the project. */
8
8
  name: string;
9
9
  /** The project's default agent. */
10
- default_agent?: Project.DefaultAgent;
10
+ default_agent: Project.DefaultAgent | null;
11
11
  }
12
12
  export declare namespace Project {
13
13
  /**
@@ -7,23 +7,23 @@ export interface ToolCallOutputProcessedPayload {
7
7
  tool_call_id: string;
8
8
  tool: ToolCallOutputProcessedPayload.Tool;
9
9
  /** Webhook endpoint URL (null for WebSocket tools) */
10
- endpoint_url?: string;
10
+ endpoint_url?: string | null;
11
11
  /** Webhook timeout in milliseconds (null for WebSocket tools) */
12
- endpoint_timeout_ms?: number;
12
+ endpoint_timeout_ms?: number | null;
13
13
  /** When webhook was called (null for WebSocket tools) */
14
- endpoint_called_at?: string;
14
+ endpoint_called_at?: string | null;
15
15
  /** Webhook request body (null for WebSocket tools) */
16
- request_body?: Record<string, unknown>;
16
+ request_body?: Record<string, unknown> | null;
17
17
  response_body?: unknown;
18
18
  /** WebSocket tool parameters (null for webhook tools) */
19
- parameters?: Record<string, unknown>;
19
+ parameters?: Record<string, unknown> | null;
20
20
  output?: unknown;
21
21
  /** Webhook HTTP status code (null for WebSocket tools) */
22
- response_status_code?: number;
22
+ response_status_code?: number | null;
23
23
  /** Whether the tool call timed out */
24
- timed_out?: boolean;
24
+ timed_out?: boolean | null;
25
25
  /** Error message if tool call failed */
26
- error_message?: string;
26
+ error_message?: string | null;
27
27
  }
28
28
  export declare namespace ToolCallOutputProcessedPayload {
29
29
  interface Tool {
@@ -7,5 +7,5 @@ export interface Voice {
7
7
  /** The voice name. */
8
8
  name: string;
9
9
  /** The voice description. */
10
- description?: string;
10
+ description: string | null;
11
11
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.7";
1
+ export declare const SDK_VERSION = "0.30.9";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.30.7";
1
+ export const SDK_VERSION = "0.30.9";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.30.7",
3
+ "version": "0.30.9",
4
4
  "private": false,
5
5
  "repository": "github:Phonic-Co/phonic-node",
6
6
  "type": "commonjs",
@@ -50,7 +50,7 @@
50
50
  "@types/jest": "^29.5.14",
51
51
  "ts-jest": "^29.3.4",
52
52
  "jest-environment-jsdom": "^29.7.0",
53
- "msw": "^2.8.4",
53
+ "msw": "2.11.2",
54
54
  "@types/node": "^18.19.70",
55
55
  "prettier": "^3.4.2",
56
56
  "typescript": "~5.7.2"
package/reference.md CHANGED
@@ -104,7 +104,9 @@ await client.agents.create({
104
104
  welcome_message: "Hi {{customer_name}}. How can I help you today?",
105
105
  system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
106
106
  template_variables: {
107
- customer_name: {},
107
+ customer_name: {
108
+ default_value: null,
109
+ },
108
110
  subject: {
109
111
  default_value: "Chess",
110
112
  },
@@ -112,6 +114,7 @@ await client.agents.create({
112
114
  tools: ["keypad_input"],
113
115
  no_input_poke_sec: 30,
114
116
  no_input_poke_text: "Are you still there?",
117
+ recognized_languages: ["en", "es"],
115
118
  boosted_keywords: ["Load ID", "dispatch"],
116
119
  configuration_endpoint: {
117
120
  url: "https://api.example.com/config",
@@ -194,7 +197,9 @@ await client.agents.upsert({
194
197
  welcome_message: "Hi {{customer_name}}. How can I help you today?",
195
198
  system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
196
199
  template_variables: {
197
- customer_name: {},
200
+ customer_name: {
201
+ default_value: null,
202
+ },
198
203
  subject: {
199
204
  default_value: "Chess",
200
205
  },
@@ -202,6 +207,7 @@ await client.agents.upsert({
202
207
  tools: ["keypad_input"],
203
208
  no_input_poke_sec: 30,
204
209
  no_input_poke_text: "Are you still there?",
210
+ recognized_languages: ["en", "es"],
205
211
  boosted_keywords: ["Load ID", "dispatch"],
206
212
  configuration_endpoint: {
207
213
  url: "https://api.example.com/config",
@@ -430,7 +436,9 @@ await client.agents.update("nameOrId", {
430
436
  welcome_message: "Hi {{customer_name}}. How can I help you today?",
431
437
  system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
432
438
  template_variables: {
433
- customer_name: {},
439
+ customer_name: {
440
+ default_value: null,
441
+ },
434
442
  subject: {
435
443
  default_value: "Chess",
436
444
  },
@@ -438,6 +446,7 @@ await client.agents.update("nameOrId", {
438
446
  tools: ["keypad_input"],
439
447
  no_input_poke_sec: 30,
440
448
  no_input_poke_text: "Are you still there?",
449
+ recognized_languages: ["en", "es"],
441
450
  boosted_keywords: ["Load ID", "dispatch"],
442
451
  configuration_endpoint: {
443
452
  url: "https://api.example.com/config",
@@ -1952,6 +1961,7 @@ await client.conversations.outboundCall({
1952
1961
  no_input_poke_sec: 30,
1953
1962
  no_input_poke_text: "Are you still there?",
1954
1963
  no_input_end_conversation_sec: 180,
1964
+ recognized_languages: ["en", "es"],
1955
1965
  boosted_keywords: ["Load ID", "dispatch"],
1956
1966
  tools: ["keypad_input"],
1957
1967
  },