phonic 0.31.4 → 0.31.6

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 (49) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/agents/client/Client.d.ts +9 -3
  3. package/dist/cjs/api/resources/agents/client/Client.js +9 -3
  4. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +10 -2
  5. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +16 -2
  6. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +5 -0
  7. package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +3 -1
  8. package/dist/cjs/api/resources/conversations/client/Client.d.ts +3 -1
  9. package/dist/cjs/api/resources/conversations/client/Client.js +3 -1
  10. package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +3 -1
  11. package/dist/cjs/api/types/Agent.d.ts +14 -2
  12. package/dist/cjs/api/types/Agent.js +5 -0
  13. package/dist/cjs/api/types/ConfigPayload.d.ts +12 -2
  14. package/dist/cjs/api/types/ConfigPayload.js +5 -0
  15. package/dist/cjs/api/types/Conversation.d.ts +14 -2
  16. package/dist/cjs/api/types/Conversation.js +5 -0
  17. package/dist/cjs/api/types/CreateAgentRequest.d.ts +13 -1
  18. package/dist/cjs/api/types/CreateAgentRequest.js +5 -0
  19. package/dist/cjs/api/types/OutboundCallConfig.d.ts +13 -1
  20. package/dist/cjs/api/types/OutboundCallConfig.js +9 -0
  21. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +1 -1
  22. package/dist/cjs/core/websocket/ws.js +6 -4
  23. package/dist/cjs/version.d.ts +1 -1
  24. package/dist/cjs/version.js +1 -1
  25. package/dist/esm/BaseClient.mjs +2 -2
  26. package/dist/esm/api/resources/agents/client/Client.d.mts +9 -3
  27. package/dist/esm/api/resources/agents/client/Client.mjs +9 -3
  28. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +10 -2
  29. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +16 -2
  30. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.mjs +5 -0
  31. package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +3 -1
  32. package/dist/esm/api/resources/conversations/client/Client.d.mts +3 -1
  33. package/dist/esm/api/resources/conversations/client/Client.mjs +3 -1
  34. package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +3 -1
  35. package/dist/esm/api/types/Agent.d.mts +14 -2
  36. package/dist/esm/api/types/Agent.mjs +5 -0
  37. package/dist/esm/api/types/ConfigPayload.d.mts +12 -2
  38. package/dist/esm/api/types/ConfigPayload.mjs +5 -0
  39. package/dist/esm/api/types/Conversation.d.mts +14 -2
  40. package/dist/esm/api/types/Conversation.mjs +5 -0
  41. package/dist/esm/api/types/CreateAgentRequest.d.mts +13 -1
  42. package/dist/esm/api/types/CreateAgentRequest.mjs +5 -0
  43. package/dist/esm/api/types/OutboundCallConfig.d.mts +13 -1
  44. package/dist/esm/api/types/OutboundCallConfig.mjs +8 -1
  45. package/dist/esm/core/fetcher/BinaryResponse.d.mts +1 -1
  46. package/dist/esm/core/websocket/ws.mjs +6 -4
  47. package/dist/esm/version.d.mts +1 -1
  48. package/dist/esm/version.mjs +1 -1
  49. package/package.json +1 -1
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "phonic",
46
- "X-Fern-SDK-Version": "0.31.3",
47
- "User-Agent": "phonic/0.31.3",
46
+ "X-Fern-SDK-Version": "0.31.4",
47
+ "User-Agent": "phonic/0.31.4",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -59,7 +59,9 @@ export declare class AgentsClient {
59
59
  * generate_no_input_poke_text: false,
60
60
  * no_input_poke_sec: 30,
61
61
  * no_input_poke_text: "Are you still there?",
62
- * languages: ["en", "es"],
62
+ * default_language: "en",
63
+ * additional_languages: ["es"],
64
+ * multilingual_mode: "request",
63
65
  * boosted_keywords: ["Load ID", "dispatch"],
64
66
  * configuration_endpoint: {
65
67
  * url: "https://api.example.com/config",
@@ -105,7 +107,9 @@ export declare class AgentsClient {
105
107
  * generate_no_input_poke_text: false,
106
108
  * no_input_poke_sec: 30,
107
109
  * no_input_poke_text: "Are you still there?",
108
- * languages: ["en", "es"],
110
+ * default_language: "en",
111
+ * additional_languages: ["es"],
112
+ * multilingual_mode: "request",
109
113
  * boosted_keywords: ["Load ID", "dispatch"],
110
114
  * configuration_endpoint: {
111
115
  * url: "https://api.example.com/config",
@@ -187,7 +191,9 @@ export declare class AgentsClient {
187
191
  * generate_no_input_poke_text: false,
188
192
  * no_input_poke_sec: 30,
189
193
  * no_input_poke_text: "Are you still there?",
190
- * languages: ["en", "es"],
194
+ * default_language: "en",
195
+ * additional_languages: ["es"],
196
+ * multilingual_mode: "request",
191
197
  * boosted_keywords: ["Load ID", "dispatch"],
192
198
  * configuration_endpoint: {
193
199
  * url: "https://api.example.com/config",
@@ -157,7 +157,9 @@ class AgentsClient {
157
157
  * generate_no_input_poke_text: false,
158
158
  * no_input_poke_sec: 30,
159
159
  * no_input_poke_text: "Are you still there?",
160
- * languages: ["en", "es"],
160
+ * default_language: "en",
161
+ * additional_languages: ["es"],
162
+ * multilingual_mode: "request",
161
163
  * boosted_keywords: ["Load ID", "dispatch"],
162
164
  * configuration_endpoint: {
163
165
  * url: "https://api.example.com/config",
@@ -252,7 +254,9 @@ class AgentsClient {
252
254
  * generate_no_input_poke_text: false,
253
255
  * no_input_poke_sec: 30,
254
256
  * no_input_poke_text: "Are you still there?",
255
- * languages: ["en", "es"],
257
+ * default_language: "en",
258
+ * additional_languages: ["es"],
259
+ * multilingual_mode: "request",
256
260
  * boosted_keywords: ["Load ID", "dispatch"],
257
261
  * configuration_endpoint: {
258
262
  * url: "https://api.example.com/config",
@@ -463,7 +467,9 @@ class AgentsClient {
463
467
  * generate_no_input_poke_text: false,
464
468
  * no_input_poke_sec: 30,
465
469
  * no_input_poke_text: "Are you still there?",
466
- * languages: ["en", "es"],
470
+ * default_language: "en",
471
+ * additional_languages: ["es"],
472
+ * multilingual_mode: "request",
467
473
  * boosted_keywords: ["Load ID", "dispatch"],
468
474
  * configuration_endpoint: {
469
475
  * url: "https://api.example.com/config",
@@ -24,7 +24,9 @@ import type * as Phonic from "../../../../index.js";
24
24
  * generate_no_input_poke_text: false,
25
25
  * no_input_poke_sec: 30,
26
26
  * no_input_poke_text: "Are you still there?",
27
- * languages: ["en", "es"],
27
+ * default_language: "en",
28
+ * additional_languages: ["es"],
29
+ * multilingual_mode: "request",
28
30
  * boosted_keywords: ["Load ID", "dispatch"],
29
31
  * configuration_endpoint: {
30
32
  * url: "https://api.example.com/config",
@@ -78,8 +80,14 @@ export interface AgentsCreateRequest {
78
80
  no_input_poke_text?: string;
79
81
  /** Seconds of silence before ending the conversation. */
80
82
  no_input_end_conversation_sec?: number;
81
- /** Array of ISO 639-1 language codes that the agent should be able to recognize */
83
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
84
+ default_language?: Phonic.LanguageCode;
85
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
86
+ additional_languages?: Phonic.LanguageCode[];
87
+ /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
82
88
  languages?: Phonic.LanguageCode[];
89
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
90
+ multilingual_mode?: Phonic.CreateAgentRequest.MultilingualMode;
83
91
  /** These words, or short phrases, will be more accurately recognized by the agent. */
84
92
  boosted_keywords?: string[];
85
93
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
@@ -24,7 +24,9 @@ import type * as Phonic from "../../../../index.js";
24
24
  * generate_no_input_poke_text: false,
25
25
  * no_input_poke_sec: 30,
26
26
  * no_input_poke_text: "Are you still there?",
27
- * languages: ["en", "es"],
27
+ * default_language: "en",
28
+ * additional_languages: ["es"],
29
+ * multilingual_mode: "request",
28
30
  * boosted_keywords: ["Load ID", "dispatch"],
29
31
  * configuration_endpoint: {
30
32
  * url: "https://api.example.com/config",
@@ -78,8 +80,14 @@ export interface UpdateAgentRequest {
78
80
  no_input_poke_text?: string;
79
81
  /** Seconds of silence before ending the conversation. */
80
82
  no_input_end_conversation_sec?: number;
81
- /** Array of ISO 639-1 language codes that the agent should be able to recognize */
83
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
84
+ default_language?: Phonic.LanguageCode;
85
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
86
+ additional_languages?: Phonic.LanguageCode[];
87
+ /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
82
88
  languages?: Phonic.LanguageCode[];
89
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
90
+ multilingual_mode?: UpdateAgentRequest.MultilingualMode;
83
91
  /** These words, or short phrases, will be more accurately recognized by the agent. */
84
92
  boosted_keywords?: string[];
85
93
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
@@ -131,6 +139,12 @@ export declare namespace UpdateAgentRequest {
131
139
  * Custom tool */
132
140
  | string;
133
141
  }
142
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
143
+ const MultilingualMode: {
144
+ readonly Auto: "auto";
145
+ readonly Request: "request";
146
+ };
147
+ type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
134
148
  /**
135
149
  * When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options.
136
150
  */
@@ -21,4 +21,9 @@ var UpdateAgentRequest;
21
21
  CallCenter: "call-center",
22
22
  CoffeeShop: "coffee-shop",
23
23
  };
24
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
25
+ UpdateAgentRequest.MultilingualMode = {
26
+ Auto: "auto",
27
+ Request: "request",
28
+ };
24
29
  })(UpdateAgentRequest || (exports.UpdateAgentRequest = UpdateAgentRequest = {}));
@@ -24,7 +24,9 @@ import type * as Phonic from "../../../../index.js";
24
24
  * generate_no_input_poke_text: false,
25
25
  * no_input_poke_sec: 30,
26
26
  * no_input_poke_text: "Are you still there?",
27
- * languages: ["en", "es"],
27
+ * default_language: "en",
28
+ * additional_languages: ["es"],
29
+ * multilingual_mode: "request",
28
30
  * boosted_keywords: ["Load ID", "dispatch"],
29
31
  * configuration_endpoint: {
30
32
  * url: "https://api.example.com/config",
@@ -192,7 +192,9 @@ export declare class ConversationsClient {
192
192
  * no_input_poke_sec: 30,
193
193
  * no_input_poke_text: "Are you still there?",
194
194
  * no_input_end_conversation_sec: 180,
195
- * languages: ["en", "es"],
195
+ * default_language: "en",
196
+ * additional_languages: ["es"],
197
+ * multilingual_mode: "request",
196
198
  * boosted_keywords: ["Load ID", "dispatch"],
197
199
  * tools: ["keypad_input"]
198
200
  * }
@@ -609,7 +609,9 @@ class ConversationsClient {
609
609
  * no_input_poke_sec: 30,
610
610
  * no_input_poke_text: "Are you still there?",
611
611
  * no_input_end_conversation_sec: 180,
612
- * languages: ["en", "es"],
612
+ * default_language: "en",
613
+ * additional_languages: ["es"],
614
+ * multilingual_mode: "request",
613
615
  * boosted_keywords: ["Load ID", "dispatch"],
614
616
  * tools: ["keypad_input"]
615
617
  * }
@@ -16,7 +16,9 @@ import type * as Phonic from "../../../../index.js";
16
16
  * no_input_poke_sec: 30,
17
17
  * no_input_poke_text: "Are you still there?",
18
18
  * no_input_end_conversation_sec: 180,
19
- * languages: ["en", "es"],
19
+ * default_language: "en",
20
+ * additional_languages: ["es"],
21
+ * multilingual_mode: "request",
20
22
  * boosted_keywords: ["Load ID", "dispatch"],
21
23
  * tools: ["keypad_input"]
22
24
  * }
@@ -42,8 +42,14 @@ export interface Agent {
42
42
  no_input_poke_text: string;
43
43
  /** Seconds of silence before ending the conversation. */
44
44
  no_input_end_conversation_sec: number;
45
- /** Array of ISO 639-1 language codes that the agent should be able to recognize */
46
- languages: Phonic.LanguageCode[];
45
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
46
+ default_language: Phonic.LanguageCode;
47
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
48
+ additional_languages: Phonic.LanguageCode[];
49
+ /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
50
+ languages?: Phonic.LanguageCode[] | undefined;
51
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
52
+ multilingual_mode: Agent.MultilingualMode;
47
53
  /** These words, or short phrases, will be more accurately recognized by the agent. */
48
54
  boosted_keywords: string[];
49
55
  /** When not `null`, the agent will call this endpoint to get configuration options. */
@@ -96,6 +102,12 @@ export declare namespace Agent {
96
102
  * Custom tool */
97
103
  | string;
98
104
  }
105
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
106
+ const MultilingualMode: {
107
+ readonly Auto: "auto";
108
+ readonly Request: "request";
109
+ };
110
+ type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
99
111
  /**
100
112
  * When not `null`, the agent will call this endpoint to get configuration options.
101
113
  */
@@ -17,4 +17,9 @@ var Agent;
17
17
  CallCenter: "call-center",
18
18
  CoffeeShop: "coffee-shop",
19
19
  };
20
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
21
+ Agent.MultilingualMode = {
22
+ Auto: "auto",
23
+ Request: "request",
24
+ };
20
25
  })(Agent || (exports.Agent = Agent = {}));
@@ -40,8 +40,12 @@ export interface ConfigPayload {
40
40
  no_input_poke_text?: string | undefined;
41
41
  /** Seconds of silence before ending conversation */
42
42
  no_input_end_conversation_sec?: number | undefined;
43
- /** Array of ISO 639-1 language codes that the agent should be able to recognize */
44
- recognized_languages?: string[] | undefined;
43
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
44
+ default_language?: string | undefined;
45
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
46
+ additional_languages?: string[] | undefined;
47
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
48
+ multilingual_mode?: ConfigPayload.MultilingualMode | undefined;
45
49
  /** Keywords to boost in speech recognition */
46
50
  boosted_keywords?: string[] | undefined;
47
51
  /** Names of tools available to the assistant. */
@@ -73,6 +77,12 @@ export declare namespace ConfigPayload {
73
77
  readonly Mulaw8000: "mulaw_8000";
74
78
  };
75
79
  type OutputFormat = (typeof OutputFormat)[keyof typeof OutputFormat];
80
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
81
+ const MultilingualMode: {
82
+ readonly Auto: "auto";
83
+ readonly Request: "request";
84
+ };
85
+ type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
76
86
  type Tools = Tools.Item[];
77
87
  namespace Tools {
78
88
  type Item = string | Record<string, unknown>;
@@ -24,4 +24,9 @@ var ConfigPayload;
24
24
  Pcm8000: "pcm_8000",
25
25
  Mulaw8000: "mulaw_8000",
26
26
  };
27
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
28
+ ConfigPayload.MultilingualMode = {
29
+ Auto: "auto",
30
+ Request: "request",
31
+ };
27
32
  })(ConfigPayload || (exports.ConfigPayload = ConfigPayload = {}));
@@ -46,8 +46,14 @@ export interface Conversation {
46
46
  ended_by: Conversation.EndedBy | null;
47
47
  /** These words, or short phrases, are more accurately recognized by the model. */
48
48
  boosted_keywords: string[] | null;
49
- /** Array of ISO 639-1 language codes recognized by the model. */
50
- languages: string[] | null;
49
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
50
+ default_language: string;
51
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
52
+ additional_languages: string[] | null;
53
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
54
+ multilingual_mode: Conversation.MultilingualMode;
55
+ /** Array of ISO 639-1 language codes recognized by the model. This field is deprecated. Use `default_language` and `additional_languages` instead. */
56
+ languages?: (string[] | null) | undefined;
51
57
  /** Whether the no-input poke text was generated by AI. */
52
58
  generate_no_input_poke_text?: (boolean | null) | undefined;
53
59
  /** Number of seconds of silence before a poke message is sent. `null` means the poke message is disabled. */
@@ -111,6 +117,12 @@ export declare namespace Conversation {
111
117
  readonly Error: "error";
112
118
  };
113
119
  type EndedBy = (typeof EndedBy)[keyof typeof EndedBy];
120
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
121
+ const MultilingualMode: {
122
+ readonly Auto: "auto";
123
+ readonly Request: "request";
124
+ };
125
+ type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
114
126
  /**
115
127
  * Phone call metadata. `null` for non-phone call conversations.
116
128
  */
@@ -26,4 +26,9 @@ var Conversation;
26
26
  Assistant: "assistant",
27
27
  Error: "error",
28
28
  };
29
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
30
+ Conversation.MultilingualMode = {
31
+ Auto: "auto",
32
+ Request: "request",
33
+ };
29
34
  })(Conversation || (exports.Conversation = Conversation = {}));
@@ -40,8 +40,14 @@ export interface CreateAgentRequest {
40
40
  no_input_poke_text?: string | undefined;
41
41
  /** Seconds of silence before ending the conversation. */
42
42
  no_input_end_conversation_sec?: number | undefined;
43
- /** Array of ISO 639-1 language codes that the agent should be able to recognize */
43
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
44
+ default_language?: Phonic.LanguageCode | undefined;
45
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
46
+ additional_languages?: Phonic.LanguageCode[] | undefined;
47
+ /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
44
48
  languages?: Phonic.LanguageCode[] | undefined;
49
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
50
+ multilingual_mode?: CreateAgentRequest.MultilingualMode | undefined;
45
51
  /** These words, or short phrases, will be more accurately recognized by the agent. */
46
52
  boosted_keywords?: string[] | undefined;
47
53
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
@@ -93,6 +99,12 @@ export declare namespace CreateAgentRequest {
93
99
  * Custom tool */
94
100
  | string;
95
101
  }
102
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
103
+ const MultilingualMode: {
104
+ readonly Auto: "auto";
105
+ readonly Request: "request";
106
+ };
107
+ type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
96
108
  /**
97
109
  * When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options.
98
110
  */
@@ -21,4 +21,9 @@ var CreateAgentRequest;
21
21
  CallCenter: "call-center",
22
22
  CoffeeShop: "coffee-shop",
23
23
  };
24
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
25
+ CreateAgentRequest.MultilingualMode = {
26
+ Auto: "auto",
27
+ Request: "request",
28
+ };
24
29
  })(CreateAgentRequest || (exports.CreateAgentRequest = CreateAgentRequest = {}));
@@ -23,14 +23,26 @@ export interface OutboundCallConfig {
23
23
  no_input_poke_text?: string | undefined;
24
24
  /** Seconds of silence before ending the conversation. */
25
25
  no_input_end_conversation_sec?: number | undefined;
26
- /** Array of ISO 639-1 language codes that the agent should be able to recognize */
26
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
27
+ default_language?: Phonic.LanguageCode | undefined;
28
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
29
+ additional_languages?: Phonic.LanguageCode[] | undefined;
30
+ /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
27
31
  languages?: Phonic.LanguageCode[] | undefined;
32
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
33
+ multilingual_mode?: OutboundCallConfig.MultilingualMode | undefined;
28
34
  /** These words, or short phrases, will be more accurately recognized by the agent. */
29
35
  boosted_keywords?: string[] | undefined;
30
36
  /** Array of built-in or custom tool names to use. */
31
37
  tools?: OutboundCallConfig.Tools.Item[] | undefined;
32
38
  }
33
39
  export declare namespace OutboundCallConfig {
40
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
41
+ const MultilingualMode: {
42
+ readonly Auto: "auto";
43
+ readonly Request: "request";
44
+ };
45
+ type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
34
46
  type Tools = Tools.Item[];
35
47
  namespace Tools {
36
48
  type Item = "keypad_input" | "natural_conversation_ending"
@@ -1,3 +1,12 @@
1
1
  "use strict";
2
2
  // This file was auto-generated by Fern from our API Definition.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.OutboundCallConfig = void 0;
5
+ var OutboundCallConfig;
6
+ (function (OutboundCallConfig) {
7
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
8
+ OutboundCallConfig.MultilingualMode = {
9
+ Auto: "auto",
10
+ Request: "request",
11
+ };
12
+ })(OutboundCallConfig || (exports.OutboundCallConfig = OutboundCallConfig = {}));
@@ -14,6 +14,6 @@ export type BinaryResponse = {
14
14
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes)
15
15
  * Some versions of the Fetch API may not support this method.
16
16
  */
17
- bytes?(): Promise<Uint8Array>;
17
+ bytes?(): ReturnType<Response["bytes"]>;
18
18
  };
19
19
  export declare function getBinaryResponse(response: Response): BinaryResponse;
@@ -39,13 +39,13 @@ const index_js_1 = require("../runtime/index.js");
39
39
  const qs_js_1 = require("../url/qs.js");
40
40
  const Events = __importStar(require("./events.js"));
41
41
  const getGlobalWebSocket = () => {
42
- if (index_js_1.RUNTIME.type === "node" || index_js_1.RUNTIME.type === "bun" || index_js_1.RUNTIME.type === "deno") {
43
- return ws_1.WebSocket;
44
- }
45
- else if (typeof WebSocket !== "undefined") {
42
+ if (typeof WebSocket !== "undefined") {
46
43
  // @ts-ignore
47
44
  return WebSocket;
48
45
  }
46
+ else if (index_js_1.RUNTIME.type === "node") {
47
+ return ws_1.WebSocket;
48
+ }
49
49
  return undefined;
50
50
  };
51
51
  /**
@@ -108,6 +108,7 @@ class ReconnectingWebSocket {
108
108
  this._clearTimeouts();
109
109
  if (this._ws) {
110
110
  this._removeListeners();
111
+ this._ws.addEventListener("error", () => { });
111
112
  try {
112
113
  this._ws.close(1000, "aborted");
113
114
  this._handleClose(new Events.CloseEvent(1000, "aborted", this));
@@ -418,6 +419,7 @@ class ReconnectingWebSocket {
418
419
  return;
419
420
  }
420
421
  this._removeListeners();
422
+ this._ws.addEventListener("error", () => { });
421
423
  try {
422
424
  this._ws.close(code, reason);
423
425
  this._handleClose(new Events.CloseEvent(code, reason, this));
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.31.3";
1
+ export declare const SDK_VERSION = "0.31.4";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.31.3";
4
+ exports.SDK_VERSION = "0.31.4";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "phonic",
9
- "X-Fern-SDK-Version": "0.31.3",
10
- "User-Agent": "phonic/0.31.3",
9
+ "X-Fern-SDK-Version": "0.31.4",
10
+ "User-Agent": "phonic/0.31.4",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -59,7 +59,9 @@ export declare class AgentsClient {
59
59
  * generate_no_input_poke_text: false,
60
60
  * no_input_poke_sec: 30,
61
61
  * no_input_poke_text: "Are you still there?",
62
- * languages: ["en", "es"],
62
+ * default_language: "en",
63
+ * additional_languages: ["es"],
64
+ * multilingual_mode: "request",
63
65
  * boosted_keywords: ["Load ID", "dispatch"],
64
66
  * configuration_endpoint: {
65
67
  * url: "https://api.example.com/config",
@@ -105,7 +107,9 @@ export declare class AgentsClient {
105
107
  * generate_no_input_poke_text: false,
106
108
  * no_input_poke_sec: 30,
107
109
  * no_input_poke_text: "Are you still there?",
108
- * languages: ["en", "es"],
110
+ * default_language: "en",
111
+ * additional_languages: ["es"],
112
+ * multilingual_mode: "request",
109
113
  * boosted_keywords: ["Load ID", "dispatch"],
110
114
  * configuration_endpoint: {
111
115
  * url: "https://api.example.com/config",
@@ -187,7 +191,9 @@ export declare class AgentsClient {
187
191
  * generate_no_input_poke_text: false,
188
192
  * no_input_poke_sec: 30,
189
193
  * no_input_poke_text: "Are you still there?",
190
- * languages: ["en", "es"],
194
+ * default_language: "en",
195
+ * additional_languages: ["es"],
196
+ * multilingual_mode: "request",
191
197
  * boosted_keywords: ["Load ID", "dispatch"],
192
198
  * configuration_endpoint: {
193
199
  * url: "https://api.example.com/config",
@@ -121,7 +121,9 @@ export class AgentsClient {
121
121
  * generate_no_input_poke_text: false,
122
122
  * no_input_poke_sec: 30,
123
123
  * no_input_poke_text: "Are you still there?",
124
- * languages: ["en", "es"],
124
+ * default_language: "en",
125
+ * additional_languages: ["es"],
126
+ * multilingual_mode: "request",
125
127
  * boosted_keywords: ["Load ID", "dispatch"],
126
128
  * configuration_endpoint: {
127
129
  * url: "https://api.example.com/config",
@@ -216,7 +218,9 @@ export class AgentsClient {
216
218
  * generate_no_input_poke_text: false,
217
219
  * no_input_poke_sec: 30,
218
220
  * no_input_poke_text: "Are you still there?",
219
- * languages: ["en", "es"],
221
+ * default_language: "en",
222
+ * additional_languages: ["es"],
223
+ * multilingual_mode: "request",
220
224
  * boosted_keywords: ["Load ID", "dispatch"],
221
225
  * configuration_endpoint: {
222
226
  * url: "https://api.example.com/config",
@@ -427,7 +431,9 @@ export class AgentsClient {
427
431
  * generate_no_input_poke_text: false,
428
432
  * no_input_poke_sec: 30,
429
433
  * no_input_poke_text: "Are you still there?",
430
- * languages: ["en", "es"],
434
+ * default_language: "en",
435
+ * additional_languages: ["es"],
436
+ * multilingual_mode: "request",
431
437
  * boosted_keywords: ["Load ID", "dispatch"],
432
438
  * configuration_endpoint: {
433
439
  * url: "https://api.example.com/config",
@@ -24,7 +24,9 @@ import type * as Phonic from "../../../../index.mjs";
24
24
  * generate_no_input_poke_text: false,
25
25
  * no_input_poke_sec: 30,
26
26
  * no_input_poke_text: "Are you still there?",
27
- * languages: ["en", "es"],
27
+ * default_language: "en",
28
+ * additional_languages: ["es"],
29
+ * multilingual_mode: "request",
28
30
  * boosted_keywords: ["Load ID", "dispatch"],
29
31
  * configuration_endpoint: {
30
32
  * url: "https://api.example.com/config",
@@ -78,8 +80,14 @@ export interface AgentsCreateRequest {
78
80
  no_input_poke_text?: string;
79
81
  /** Seconds of silence before ending the conversation. */
80
82
  no_input_end_conversation_sec?: number;
81
- /** Array of ISO 639-1 language codes that the agent should be able to recognize */
83
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
84
+ default_language?: Phonic.LanguageCode;
85
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
86
+ additional_languages?: Phonic.LanguageCode[];
87
+ /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
82
88
  languages?: Phonic.LanguageCode[];
89
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
90
+ multilingual_mode?: Phonic.CreateAgentRequest.MultilingualMode;
83
91
  /** These words, or short phrases, will be more accurately recognized by the agent. */
84
92
  boosted_keywords?: string[];
85
93
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
@@ -24,7 +24,9 @@ import type * as Phonic from "../../../../index.mjs";
24
24
  * generate_no_input_poke_text: false,
25
25
  * no_input_poke_sec: 30,
26
26
  * no_input_poke_text: "Are you still there?",
27
- * languages: ["en", "es"],
27
+ * default_language: "en",
28
+ * additional_languages: ["es"],
29
+ * multilingual_mode: "request",
28
30
  * boosted_keywords: ["Load ID", "dispatch"],
29
31
  * configuration_endpoint: {
30
32
  * url: "https://api.example.com/config",
@@ -78,8 +80,14 @@ export interface UpdateAgentRequest {
78
80
  no_input_poke_text?: string;
79
81
  /** Seconds of silence before ending the conversation. */
80
82
  no_input_end_conversation_sec?: number;
81
- /** Array of ISO 639-1 language codes that the agent should be able to recognize */
83
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
84
+ default_language?: Phonic.LanguageCode;
85
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
86
+ additional_languages?: Phonic.LanguageCode[];
87
+ /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
82
88
  languages?: Phonic.LanguageCode[];
89
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
90
+ multilingual_mode?: UpdateAgentRequest.MultilingualMode;
83
91
  /** These words, or short phrases, will be more accurately recognized by the agent. */
84
92
  boosted_keywords?: string[];
85
93
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
@@ -131,6 +139,12 @@ export declare namespace UpdateAgentRequest {
131
139
  * Custom tool */
132
140
  | string;
133
141
  }
142
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
143
+ const MultilingualMode: {
144
+ readonly Auto: "auto";
145
+ readonly Request: "request";
146
+ };
147
+ type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
134
148
  /**
135
149
  * When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options.
136
150
  */
@@ -18,4 +18,9 @@ export var UpdateAgentRequest;
18
18
  CallCenter: "call-center",
19
19
  CoffeeShop: "coffee-shop",
20
20
  };
21
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
22
+ UpdateAgentRequest.MultilingualMode = {
23
+ Auto: "auto",
24
+ Request: "request",
25
+ };
21
26
  })(UpdateAgentRequest || (UpdateAgentRequest = {}));
@@ -24,7 +24,9 @@ import type * as Phonic from "../../../../index.mjs";
24
24
  * generate_no_input_poke_text: false,
25
25
  * no_input_poke_sec: 30,
26
26
  * no_input_poke_text: "Are you still there?",
27
- * languages: ["en", "es"],
27
+ * default_language: "en",
28
+ * additional_languages: ["es"],
29
+ * multilingual_mode: "request",
28
30
  * boosted_keywords: ["Load ID", "dispatch"],
29
31
  * configuration_endpoint: {
30
32
  * url: "https://api.example.com/config",
@@ -192,7 +192,9 @@ export declare class ConversationsClient {
192
192
  * no_input_poke_sec: 30,
193
193
  * no_input_poke_text: "Are you still there?",
194
194
  * no_input_end_conversation_sec: 180,
195
- * languages: ["en", "es"],
195
+ * default_language: "en",
196
+ * additional_languages: ["es"],
197
+ * multilingual_mode: "request",
196
198
  * boosted_keywords: ["Load ID", "dispatch"],
197
199
  * tools: ["keypad_input"]
198
200
  * }
@@ -573,7 +573,9 @@ export class ConversationsClient {
573
573
  * no_input_poke_sec: 30,
574
574
  * no_input_poke_text: "Are you still there?",
575
575
  * no_input_end_conversation_sec: 180,
576
- * languages: ["en", "es"],
576
+ * default_language: "en",
577
+ * additional_languages: ["es"],
578
+ * multilingual_mode: "request",
577
579
  * boosted_keywords: ["Load ID", "dispatch"],
578
580
  * tools: ["keypad_input"]
579
581
  * }
@@ -16,7 +16,9 @@ import type * as Phonic from "../../../../index.mjs";
16
16
  * no_input_poke_sec: 30,
17
17
  * no_input_poke_text: "Are you still there?",
18
18
  * no_input_end_conversation_sec: 180,
19
- * languages: ["en", "es"],
19
+ * default_language: "en",
20
+ * additional_languages: ["es"],
21
+ * multilingual_mode: "request",
20
22
  * boosted_keywords: ["Load ID", "dispatch"],
21
23
  * tools: ["keypad_input"]
22
24
  * }
@@ -42,8 +42,14 @@ export interface Agent {
42
42
  no_input_poke_text: string;
43
43
  /** Seconds of silence before ending the conversation. */
44
44
  no_input_end_conversation_sec: number;
45
- /** Array of ISO 639-1 language codes that the agent should be able to recognize */
46
- languages: Phonic.LanguageCode[];
45
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
46
+ default_language: Phonic.LanguageCode;
47
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
48
+ additional_languages: Phonic.LanguageCode[];
49
+ /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
50
+ languages?: Phonic.LanguageCode[] | undefined;
51
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
52
+ multilingual_mode: Agent.MultilingualMode;
47
53
  /** These words, or short phrases, will be more accurately recognized by the agent. */
48
54
  boosted_keywords: string[];
49
55
  /** When not `null`, the agent will call this endpoint to get configuration options. */
@@ -96,6 +102,12 @@ export declare namespace Agent {
96
102
  * Custom tool */
97
103
  | string;
98
104
  }
105
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
106
+ const MultilingualMode: {
107
+ readonly Auto: "auto";
108
+ readonly Request: "request";
109
+ };
110
+ type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
99
111
  /**
100
112
  * When not `null`, the agent will call this endpoint to get configuration options.
101
113
  */
@@ -14,4 +14,9 @@ export var Agent;
14
14
  CallCenter: "call-center",
15
15
  CoffeeShop: "coffee-shop",
16
16
  };
17
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
18
+ Agent.MultilingualMode = {
19
+ Auto: "auto",
20
+ Request: "request",
21
+ };
17
22
  })(Agent || (Agent = {}));
@@ -40,8 +40,12 @@ export interface ConfigPayload {
40
40
  no_input_poke_text?: string | undefined;
41
41
  /** Seconds of silence before ending conversation */
42
42
  no_input_end_conversation_sec?: number | undefined;
43
- /** Array of ISO 639-1 language codes that the agent should be able to recognize */
44
- recognized_languages?: string[] | undefined;
43
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
44
+ default_language?: string | undefined;
45
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
46
+ additional_languages?: string[] | undefined;
47
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
48
+ multilingual_mode?: ConfigPayload.MultilingualMode | undefined;
45
49
  /** Keywords to boost in speech recognition */
46
50
  boosted_keywords?: string[] | undefined;
47
51
  /** Names of tools available to the assistant. */
@@ -73,6 +77,12 @@ export declare namespace ConfigPayload {
73
77
  readonly Mulaw8000: "mulaw_8000";
74
78
  };
75
79
  type OutputFormat = (typeof OutputFormat)[keyof typeof OutputFormat];
80
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
81
+ const MultilingualMode: {
82
+ readonly Auto: "auto";
83
+ readonly Request: "request";
84
+ };
85
+ type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
76
86
  type Tools = Tools.Item[];
77
87
  namespace Tools {
78
88
  type Item = string | Record<string, unknown>;
@@ -21,4 +21,9 @@ export var ConfigPayload;
21
21
  Pcm8000: "pcm_8000",
22
22
  Mulaw8000: "mulaw_8000",
23
23
  };
24
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
25
+ ConfigPayload.MultilingualMode = {
26
+ Auto: "auto",
27
+ Request: "request",
28
+ };
24
29
  })(ConfigPayload || (ConfigPayload = {}));
@@ -46,8 +46,14 @@ export interface Conversation {
46
46
  ended_by: Conversation.EndedBy | null;
47
47
  /** These words, or short phrases, are more accurately recognized by the model. */
48
48
  boosted_keywords: string[] | null;
49
- /** Array of ISO 639-1 language codes recognized by the model. */
50
- languages: string[] | null;
49
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
50
+ default_language: string;
51
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
52
+ additional_languages: string[] | null;
53
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
54
+ multilingual_mode: Conversation.MultilingualMode;
55
+ /** Array of ISO 639-1 language codes recognized by the model. This field is deprecated. Use `default_language` and `additional_languages` instead. */
56
+ languages?: (string[] | null) | undefined;
51
57
  /** Whether the no-input poke text was generated by AI. */
52
58
  generate_no_input_poke_text?: (boolean | null) | undefined;
53
59
  /** Number of seconds of silence before a poke message is sent. `null` means the poke message is disabled. */
@@ -111,6 +117,12 @@ export declare namespace Conversation {
111
117
  readonly Error: "error";
112
118
  };
113
119
  type EndedBy = (typeof EndedBy)[keyof typeof EndedBy];
120
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
121
+ const MultilingualMode: {
122
+ readonly Auto: "auto";
123
+ readonly Request: "request";
124
+ };
125
+ type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
114
126
  /**
115
127
  * Phone call metadata. `null` for non-phone call conversations.
116
128
  */
@@ -23,4 +23,9 @@ export var Conversation;
23
23
  Assistant: "assistant",
24
24
  Error: "error",
25
25
  };
26
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
27
+ Conversation.MultilingualMode = {
28
+ Auto: "auto",
29
+ Request: "request",
30
+ };
26
31
  })(Conversation || (Conversation = {}));
@@ -40,8 +40,14 @@ export interface CreateAgentRequest {
40
40
  no_input_poke_text?: string | undefined;
41
41
  /** Seconds of silence before ending the conversation. */
42
42
  no_input_end_conversation_sec?: number | undefined;
43
- /** Array of ISO 639-1 language codes that the agent should be able to recognize */
43
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
44
+ default_language?: Phonic.LanguageCode | undefined;
45
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
46
+ additional_languages?: Phonic.LanguageCode[] | undefined;
47
+ /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
44
48
  languages?: Phonic.LanguageCode[] | undefined;
49
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
50
+ multilingual_mode?: CreateAgentRequest.MultilingualMode | undefined;
45
51
  /** These words, or short phrases, will be more accurately recognized by the agent. */
46
52
  boosted_keywords?: string[] | undefined;
47
53
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
@@ -93,6 +99,12 @@ export declare namespace CreateAgentRequest {
93
99
  * Custom tool */
94
100
  | string;
95
101
  }
102
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
103
+ const MultilingualMode: {
104
+ readonly Auto: "auto";
105
+ readonly Request: "request";
106
+ };
107
+ type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
96
108
  /**
97
109
  * When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options.
98
110
  */
@@ -18,4 +18,9 @@ export var CreateAgentRequest;
18
18
  CallCenter: "call-center",
19
19
  CoffeeShop: "coffee-shop",
20
20
  };
21
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
22
+ CreateAgentRequest.MultilingualMode = {
23
+ Auto: "auto",
24
+ Request: "request",
25
+ };
21
26
  })(CreateAgentRequest || (CreateAgentRequest = {}));
@@ -23,14 +23,26 @@ export interface OutboundCallConfig {
23
23
  no_input_poke_text?: string | undefined;
24
24
  /** Seconds of silence before ending the conversation. */
25
25
  no_input_end_conversation_sec?: number | undefined;
26
- /** Array of ISO 639-1 language codes that the agent should be able to recognize */
26
+ /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
27
+ default_language?: Phonic.LanguageCode | undefined;
28
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
29
+ additional_languages?: Phonic.LanguageCode[] | undefined;
30
+ /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
27
31
  languages?: Phonic.LanguageCode[] | undefined;
32
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
33
+ multilingual_mode?: OutboundCallConfig.MultilingualMode | undefined;
28
34
  /** These words, or short phrases, will be more accurately recognized by the agent. */
29
35
  boosted_keywords?: string[] | undefined;
30
36
  /** Array of built-in or custom tool names to use. */
31
37
  tools?: OutboundCallConfig.Tools.Item[] | undefined;
32
38
  }
33
39
  export declare namespace OutboundCallConfig {
40
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
41
+ const MultilingualMode: {
42
+ readonly Auto: "auto";
43
+ readonly Request: "request";
44
+ };
45
+ type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
34
46
  type Tools = Tools.Item[];
35
47
  namespace Tools {
36
48
  type Item = "keypad_input" | "natural_conversation_ending"
@@ -1,2 +1,9 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
- export {};
2
+ export var OutboundCallConfig;
3
+ (function (OutboundCallConfig) {
4
+ /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
5
+ OutboundCallConfig.MultilingualMode = {
6
+ Auto: "auto",
7
+ Request: "request",
8
+ };
9
+ })(OutboundCallConfig || (OutboundCallConfig = {}));
@@ -14,6 +14,6 @@ export type BinaryResponse = {
14
14
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes)
15
15
  * Some versions of the Fetch API may not support this method.
16
16
  */
17
- bytes?(): Promise<Uint8Array>;
17
+ bytes?(): ReturnType<Response["bytes"]>;
18
18
  };
19
19
  export declare function getBinaryResponse(response: Response): BinaryResponse;
@@ -3,13 +3,13 @@ import { RUNTIME } from "../runtime/index.mjs";
3
3
  import { toQueryString } from "../url/qs.mjs";
4
4
  import * as Events from "./events.mjs";
5
5
  const getGlobalWebSocket = () => {
6
- if (RUNTIME.type === "node" || RUNTIME.type === "bun" || RUNTIME.type === "deno") {
7
- return NodeWebSocket;
8
- }
9
- else if (typeof WebSocket !== "undefined") {
6
+ if (typeof WebSocket !== "undefined") {
10
7
  // @ts-ignore
11
8
  return WebSocket;
12
9
  }
10
+ else if (RUNTIME.type === "node") {
11
+ return NodeWebSocket;
12
+ }
13
13
  return undefined;
14
14
  };
15
15
  /**
@@ -72,6 +72,7 @@ export class ReconnectingWebSocket {
72
72
  this._clearTimeouts();
73
73
  if (this._ws) {
74
74
  this._removeListeners();
75
+ this._ws.addEventListener("error", () => { });
75
76
  try {
76
77
  this._ws.close(1000, "aborted");
77
78
  this._handleClose(new Events.CloseEvent(1000, "aborted", this));
@@ -382,6 +383,7 @@ export class ReconnectingWebSocket {
382
383
  return;
383
384
  }
384
385
  this._removeListeners();
386
+ this._ws.addEventListener("error", () => { });
385
387
  try {
386
388
  this._ws.close(code, reason);
387
389
  this._handleClose(new Events.CloseEvent(code, reason, this));
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.31.3";
1
+ export declare const SDK_VERSION = "0.31.4";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.31.3";
1
+ export const SDK_VERSION = "0.31.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.31.4",
3
+ "version": "0.31.6",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",