phonic 0.30.9 → 0.30.11

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 (69) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/Client.d.ts +2 -2
  3. package/dist/cjs/Client.js +2 -2
  4. package/dist/cjs/api/resources/agents/client/Client.d.ts +5 -5
  5. package/dist/cjs/api/resources/agents/client/Client.js +3 -3
  6. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +4 -2
  7. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +13 -2
  8. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +5 -0
  9. package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +1 -1
  10. package/dist/cjs/api/resources/conversations/client/Client.d.ts +3 -3
  11. package/dist/cjs/api/resources/conversations/client/Client.js +1 -1
  12. package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +1 -1
  13. package/dist/cjs/api/resources/extractionSchemas/client/Client.d.ts +2 -2
  14. package/dist/cjs/api/resources/projects/client/Client.d.ts +2 -2
  15. package/dist/cjs/api/resources/tools/client/Client.d.ts +2 -2
  16. package/dist/cjs/api/resources/voices/client/Client.d.ts +2 -2
  17. package/dist/cjs/api/types/Agent.d.ts +12 -1
  18. package/dist/cjs/api/types/Agent.js +5 -0
  19. package/dist/cjs/api/types/ConfigPayload.d.ts +11 -0
  20. package/dist/cjs/api/types/ConfigPayload.js +5 -0
  21. package/dist/cjs/api/types/Conversation.d.ts +23 -2
  22. package/dist/cjs/api/types/Conversation.js +5 -0
  23. package/dist/cjs/api/types/CreateAgentRequest.d.ts +12 -1
  24. package/dist/cjs/api/types/CreateAgentRequest.js +5 -0
  25. package/dist/cjs/api/types/LanguageCode.d.ts +28 -0
  26. package/dist/cjs/api/types/LanguageCode.js +27 -0
  27. package/dist/cjs/api/types/OutboundCallConfig.d.ts +2 -1
  28. package/dist/cjs/api/types/index.d.ts +1 -0
  29. package/dist/cjs/api/types/index.js +1 -0
  30. package/dist/cjs/core/fetcher/Fetcher.d.ts +1 -1
  31. package/dist/cjs/core/fetcher/requestWithRetries.js +44 -8
  32. package/dist/cjs/core/headers.d.ts +2 -2
  33. package/dist/cjs/version.d.ts +1 -1
  34. package/dist/cjs/version.js +1 -1
  35. package/dist/esm/Client.d.mts +2 -2
  36. package/dist/esm/Client.mjs +2 -2
  37. package/dist/esm/api/resources/agents/client/Client.d.mts +5 -5
  38. package/dist/esm/api/resources/agents/client/Client.mjs +3 -3
  39. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +4 -2
  40. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +13 -2
  41. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.mjs +5 -0
  42. package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +1 -1
  43. package/dist/esm/api/resources/conversations/client/Client.d.mts +3 -3
  44. package/dist/esm/api/resources/conversations/client/Client.mjs +1 -1
  45. package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +1 -1
  46. package/dist/esm/api/resources/extractionSchemas/client/Client.d.mts +2 -2
  47. package/dist/esm/api/resources/projects/client/Client.d.mts +2 -2
  48. package/dist/esm/api/resources/tools/client/Client.d.mts +2 -2
  49. package/dist/esm/api/resources/voices/client/Client.d.mts +2 -2
  50. package/dist/esm/api/types/Agent.d.mts +12 -1
  51. package/dist/esm/api/types/Agent.mjs +5 -0
  52. package/dist/esm/api/types/ConfigPayload.d.mts +11 -0
  53. package/dist/esm/api/types/ConfigPayload.mjs +5 -0
  54. package/dist/esm/api/types/Conversation.d.mts +23 -2
  55. package/dist/esm/api/types/Conversation.mjs +5 -0
  56. package/dist/esm/api/types/CreateAgentRequest.d.mts +12 -1
  57. package/dist/esm/api/types/CreateAgentRequest.mjs +5 -0
  58. package/dist/esm/api/types/LanguageCode.d.mts +28 -0
  59. package/dist/esm/api/types/LanguageCode.mjs +24 -0
  60. package/dist/esm/api/types/OutboundCallConfig.d.mts +2 -1
  61. package/dist/esm/api/types/index.d.mts +1 -0
  62. package/dist/esm/api/types/index.mjs +1 -0
  63. package/dist/esm/core/fetcher/Fetcher.d.mts +1 -1
  64. package/dist/esm/core/fetcher/requestWithRetries.mjs +44 -8
  65. package/dist/esm/core/headers.d.mts +2 -2
  66. package/dist/esm/version.d.mts +1 -1
  67. package/dist/esm/version.mjs +1 -1
  68. package/package.json +1 -1
  69. package/reference.md +4 -4
@@ -14,21 +14,57 @@ const INITIAL_RETRY_DELAY = 1000; // in milliseconds
14
14
  const MAX_RETRY_DELAY = 60000; // in milliseconds
15
15
  const DEFAULT_MAX_RETRIES = 2;
16
16
  const JITTER_FACTOR = 0.2; // 20% random jitter
17
- function addJitter(delay) {
18
- // Generate a random value between -JITTER_FACTOR and +JITTER_FACTOR
19
- const jitterMultiplier = 1 + (Math.random() * 2 - 1) * JITTER_FACTOR;
17
+ function addPositiveJitter(delay) {
18
+ // Generate a random value between 0 and +JITTER_FACTOR
19
+ const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR;
20
20
  return delay * jitterMultiplier;
21
21
  }
22
+ function addSymmetricJitter(delay) {
23
+ // Generate a random value in a JITTER_FACTOR-sized percentage range around delay
24
+ const jitterMultiplier = 1 + (Math.random() - 0.5) * JITTER_FACTOR;
25
+ return delay * jitterMultiplier;
26
+ }
27
+ function getRetryDelayFromHeaders(response, retryAttempt) {
28
+ // Check for Retry-After header first (RFC 7231), with no jitter
29
+ const retryAfter = response.headers.get("Retry-After");
30
+ if (retryAfter) {
31
+ // Parse as number of seconds...
32
+ const retryAfterSeconds = parseInt(retryAfter, 10);
33
+ if (!isNaN(retryAfterSeconds) && retryAfterSeconds > 0) {
34
+ return Math.min(retryAfterSeconds * 1000, MAX_RETRY_DELAY);
35
+ }
36
+ // ...or as an HTTP date; both are valid
37
+ const retryAfterDate = new Date(retryAfter);
38
+ if (!isNaN(retryAfterDate.getTime())) {
39
+ const delay = retryAfterDate.getTime() - Date.now();
40
+ if (delay > 0) {
41
+ return Math.min(Math.max(delay, 0), MAX_RETRY_DELAY);
42
+ }
43
+ }
44
+ }
45
+ // Then check for industry-standard X-RateLimit-Reset header, with positive jitter
46
+ const rateLimitReset = response.headers.get("X-RateLimit-Reset");
47
+ if (rateLimitReset) {
48
+ const resetTime = parseInt(rateLimitReset, 10);
49
+ if (!isNaN(resetTime)) {
50
+ // Assume Unix timestamp in epoch seconds
51
+ const delay = resetTime * 1000 - Date.now();
52
+ if (delay > 0) {
53
+ return addPositiveJitter(Math.min(delay, MAX_RETRY_DELAY));
54
+ }
55
+ }
56
+ }
57
+ // Fall back to exponential backoff, with symmetric jitter
58
+ return addSymmetricJitter(Math.min(INITIAL_RETRY_DELAY * Math.pow(2, retryAttempt), MAX_RETRY_DELAY));
59
+ }
22
60
  function requestWithRetries(requestFn_1) {
23
61
  return __awaiter(this, arguments, void 0, function* (requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
24
62
  let response = yield requestFn();
25
63
  for (let i = 0; i < maxRetries; ++i) {
26
64
  if ([408, 429].includes(response.status) || response.status >= 500) {
27
- // Calculate base delay using exponential backoff (in milliseconds)
28
- const baseDelay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY);
29
- // Add jitter to the delay
30
- const delayWithJitter = addJitter(baseDelay);
31
- yield new Promise((resolve) => setTimeout(resolve, delayWithJitter));
65
+ // Get delay with appropriate jitter applied
66
+ const delay = getRetryDelayFromHeaders(response, i);
67
+ yield new Promise((resolve) => setTimeout(resolve, delay));
32
68
  response = yield requestFn();
33
69
  }
34
70
  else {
@@ -1,3 +1,3 @@
1
1
  import * as core from "./index.js";
2
- export declare function mergeHeaders(...headersArray: (Record<string, string | core.Supplier<string | undefined> | undefined> | undefined)[]): Record<string, string | core.Supplier<string | undefined>>;
3
- export declare function mergeOnlyDefinedHeaders(...headersArray: (Record<string, string | core.Supplier<string | undefined> | undefined> | undefined)[]): Record<string, string | core.Supplier<string | undefined>>;
2
+ export declare function mergeHeaders(...headersArray: (Record<string, string | core.Supplier<string | null | undefined> | null | undefined> | null | undefined)[]): Record<string, string | core.Supplier<string | null | undefined>>;
3
+ export declare function mergeOnlyDefinedHeaders(...headersArray: (Record<string, string | core.Supplier<string | null | undefined> | null | undefined> | null | undefined)[]): Record<string, string | core.Supplier<string | null | undefined>>;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.9";
1
+ export declare const SDK_VERSION = "0.30.11";
@@ -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.30.9";
4
+ exports.SDK_VERSION = "0.30.11";
@@ -16,7 +16,7 @@ export declare namespace PhonicClient {
16
16
  baseUrl?: core.Supplier<string>;
17
17
  apiKey?: core.Supplier<core.BearerToken | undefined>;
18
18
  /** Additional headers to include in requests. */
19
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
19
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
20
20
  fetcher?: core.FetchFunction;
21
21
  }
22
22
  interface RequestOptions {
@@ -29,7 +29,7 @@ export declare namespace PhonicClient {
29
29
  /** Additional query string parameters to include in the request. */
30
30
  queryParams?: Record<string, unknown>;
31
31
  /** Additional headers to include in the request. */
32
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
32
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
33
33
  }
34
34
  }
35
35
  export declare class PhonicClient {
@@ -14,8 +14,8 @@ export class PhonicClient {
14
14
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
15
15
  "X-Fern-Language": "JavaScript",
16
16
  "X-Fern-SDK-Name": "phonic",
17
- "X-Fern-SDK-Version": "0.30.9",
18
- "User-Agent": "phonic/0.30.9",
17
+ "X-Fern-SDK-Version": "0.30.11",
18
+ "User-Agent": "phonic/0.30.11",
19
19
  "X-Fern-Runtime": core.RUNTIME.type,
20
20
  "X-Fern-Runtime-Version": core.RUNTIME.version,
21
21
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -11,7 +11,7 @@ export declare namespace Agents {
11
11
  baseUrl?: core.Supplier<string>;
12
12
  apiKey?: core.Supplier<core.BearerToken | undefined>;
13
13
  /** Additional headers to include in requests. */
14
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
14
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
15
15
  fetcher?: core.FetchFunction;
16
16
  }
17
17
  interface RequestOptions {
@@ -24,7 +24,7 @@ export declare namespace Agents {
24
24
  /** Additional query string parameters to include in the request. */
25
25
  queryParams?: Record<string, unknown>;
26
26
  /** Additional headers to include in the request. */
27
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
27
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
28
28
  }
29
29
  }
30
30
  export declare class Agents {
@@ -77,7 +77,7 @@ export declare class Agents {
77
77
  * tools: ["keypad_input"],
78
78
  * no_input_poke_sec: 30,
79
79
  * no_input_poke_text: "Are you still there?",
80
- * recognized_languages: ["en", "es"],
80
+ * languages: ["en", "es"],
81
81
  * boosted_keywords: ["Load ID", "dispatch"],
82
82
  * configuration_endpoint: {
83
83
  * url: "https://api.example.com/config",
@@ -121,7 +121,7 @@ export declare class Agents {
121
121
  * tools: ["keypad_input"],
122
122
  * no_input_poke_sec: 30,
123
123
  * no_input_poke_text: "Are you still there?",
124
- * recognized_languages: ["en", "es"],
124
+ * languages: ["en", "es"],
125
125
  * boosted_keywords: ["Load ID", "dispatch"],
126
126
  * configuration_endpoint: {
127
127
  * url: "https://api.example.com/config",
@@ -201,7 +201,7 @@ export declare class Agents {
201
201
  * tools: ["keypad_input"],
202
202
  * no_input_poke_sec: 30,
203
203
  * no_input_poke_text: "Are you still there?",
204
- * recognized_languages: ["en", "es"],
204
+ * languages: ["en", "es"],
205
205
  * boosted_keywords: ["Load ID", "dispatch"],
206
206
  * configuration_endpoint: {
207
207
  * url: "https://api.example.com/config",
@@ -131,7 +131,7 @@ export class Agents {
131
131
  * tools: ["keypad_input"],
132
132
  * no_input_poke_sec: 30,
133
133
  * no_input_poke_text: "Are you still there?",
134
- * recognized_languages: ["en", "es"],
134
+ * languages: ["en", "es"],
135
135
  * boosted_keywords: ["Load ID", "dispatch"],
136
136
  * configuration_endpoint: {
137
137
  * url: "https://api.example.com/config",
@@ -236,7 +236,7 @@ export class Agents {
236
236
  * tools: ["keypad_input"],
237
237
  * no_input_poke_sec: 30,
238
238
  * no_input_poke_text: "Are you still there?",
239
- * recognized_languages: ["en", "es"],
239
+ * languages: ["en", "es"],
240
240
  * boosted_keywords: ["Load ID", "dispatch"],
241
241
  * configuration_endpoint: {
242
242
  * url: "https://api.example.com/config",
@@ -481,7 +481,7 @@ export class Agents {
481
481
  * tools: ["keypad_input"],
482
482
  * no_input_poke_sec: 30,
483
483
  * no_input_poke_text: "Are you still there?",
484
- * recognized_languages: ["en", "es"],
484
+ * languages: ["en", "es"],
485
485
  * boosted_keywords: ["Load ID", "dispatch"],
486
486
  * configuration_endpoint: {
487
487
  * url: "https://api.example.com/config",
@@ -25,7 +25,7 @@ import * as Phonic from "../../../../index.mjs";
25
25
  * tools: ["keypad_input"],
26
26
  * no_input_poke_sec: 30,
27
27
  * no_input_poke_text: "Are you still there?",
28
- * recognized_languages: ["en", "es"],
28
+ * languages: ["en", "es"],
29
29
  * boosted_keywords: ["Load ID", "dispatch"],
30
30
  * configuration_endpoint: {
31
31
  * url: "https://api.example.com/config",
@@ -52,6 +52,8 @@ export interface AgentsCreateRequest {
52
52
  audio_speed?: number;
53
53
  /** The background noise level of the agent. */
54
54
  background_noise_level?: number;
55
+ /** The background noise type. Can be "office", "call-center", "coffee-shop", or null. */
56
+ background_noise?: Phonic.CreateAgentRequest.BackgroundNoise | null;
55
57
  /** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. */
56
58
  welcome_message?: string;
57
59
  /** Instructions for the conversation. Can contain template variables like `{{subject}}`. */
@@ -69,7 +71,7 @@ export interface AgentsCreateRequest {
69
71
  /** Seconds of silence before ending the conversation. */
70
72
  no_input_end_conversation_sec?: number;
71
73
  /** Array of ISO 639-1 language codes that the agent should be able to recognize */
72
- recognized_languages?: string[];
74
+ languages?: Phonic.LanguageCode[];
73
75
  /** These words, or short phrases, will be more accurately recognized by the agent. */
74
76
  boosted_keywords?: string[];
75
77
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint when to get configuration options. */
@@ -25,7 +25,7 @@ import * as Phonic from "../../../../index.mjs";
25
25
  * tools: ["keypad_input"],
26
26
  * no_input_poke_sec: 30,
27
27
  * no_input_poke_text: "Are you still there?",
28
- * recognized_languages: ["en", "es"],
28
+ * languages: ["en", "es"],
29
29
  * boosted_keywords: ["Load ID", "dispatch"],
30
30
  * configuration_endpoint: {
31
31
  * url: "https://api.example.com/config",
@@ -52,6 +52,8 @@ export interface UpdateAgentRequest {
52
52
  audio_speed?: number;
53
53
  /** The background noise level of the agent. */
54
54
  background_noise_level?: number;
55
+ /** The background noise type. Can be "office", "call-center", "coffee-shop", or null. */
56
+ background_noise?: UpdateAgentRequest.BackgroundNoise | null;
55
57
  /** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. */
56
58
  welcome_message?: string;
57
59
  /** Instructions for the conversation. Can contain template variables like `{{subject}}`. */
@@ -69,7 +71,7 @@ export interface UpdateAgentRequest {
69
71
  /** Seconds of silence before ending the conversation. */
70
72
  no_input_end_conversation_sec?: number;
71
73
  /** Array of ISO 639-1 language codes that the agent should be able to recognize */
72
- recognized_languages?: string[];
74
+ languages?: Phonic.LanguageCode[];
73
75
  /** These words, or short phrases, will be more accurately recognized by the agent. */
74
76
  boosted_keywords?: string[];
75
77
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint when to get configuration options. */
@@ -86,6 +88,15 @@ export declare namespace UpdateAgentRequest {
86
88
  readonly Pcm8000: "pcm_8000";
87
89
  readonly Mulaw8000: "mulaw_8000";
88
90
  };
91
+ /**
92
+ * The background noise type. Can be "office", "call-center", "coffee-shop", or null.
93
+ */
94
+ type BackgroundNoise = "office" | "call-center" | "coffee-shop";
95
+ const BackgroundNoise: {
96
+ readonly Office: "office";
97
+ readonly CallCenter: "call-center";
98
+ readonly CoffeeShop: "coffee-shop";
99
+ };
89
100
  namespace TemplateVariables {
90
101
  interface Value {
91
102
  default_value: string | null;
@@ -9,4 +9,9 @@ export var UpdateAgentRequest;
9
9
  Pcm8000: "pcm_8000",
10
10
  Mulaw8000: "mulaw_8000",
11
11
  };
12
+ UpdateAgentRequest.BackgroundNoise = {
13
+ Office: "office",
14
+ CallCenter: "call-center",
15
+ CoffeeShop: "coffee-shop",
16
+ };
12
17
  })(UpdateAgentRequest || (UpdateAgentRequest = {}));
@@ -25,7 +25,7 @@ import * as Phonic from "../../../../index.mjs";
25
25
  * tools: ["keypad_input"],
26
26
  * no_input_poke_sec: 30,
27
27
  * no_input_poke_text: "Are you still there?",
28
- * recognized_languages: ["en", "es"],
28
+ * languages: ["en", "es"],
29
29
  * boosted_keywords: ["Load ID", "dispatch"],
30
30
  * configuration_endpoint: {
31
31
  * url: "https://api.example.com/config",
@@ -12,7 +12,7 @@ export declare namespace Conversations {
12
12
  baseUrl?: core.Supplier<string>;
13
13
  apiKey?: core.Supplier<core.BearerToken | undefined>;
14
14
  /** Additional headers to include in requests. */
15
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
16
16
  fetcher?: core.FetchFunction;
17
17
  }
18
18
  interface RequestOptions {
@@ -25,7 +25,7 @@ export declare namespace Conversations {
25
25
  /** Additional query string parameters to include in the request. */
26
26
  queryParams?: Record<string, unknown>;
27
27
  /** Additional headers to include in the request. */
28
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
28
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
29
29
  }
30
30
  interface ConnectArgs {
31
31
  downstream_websocket_url?: string | undefined;
@@ -205,7 +205,7 @@ export declare class Conversations {
205
205
  * no_input_poke_sec: 30,
206
206
  * no_input_poke_text: "Are you still there?",
207
207
  * no_input_end_conversation_sec: 180,
208
- * recognized_languages: ["en", "es"],
208
+ * languages: ["en", "es"],
209
209
  * boosted_keywords: ["Load ID", "dispatch"],
210
210
  * tools: ["keypad_input"]
211
211
  * }
@@ -677,7 +677,7 @@ export class Conversations {
677
677
  * no_input_poke_sec: 30,
678
678
  * no_input_poke_text: "Are you still there?",
679
679
  * no_input_end_conversation_sec: 180,
680
- * recognized_languages: ["en", "es"],
680
+ * languages: ["en", "es"],
681
681
  * boosted_keywords: ["Load ID", "dispatch"],
682
682
  * tools: ["keypad_input"]
683
683
  * }
@@ -18,7 +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
+ * languages: ["en", "es"],
22
22
  * boosted_keywords: ["Load ID", "dispatch"],
23
23
  * tools: ["keypad_input"]
24
24
  * }
@@ -11,7 +11,7 @@ export declare namespace ExtractionSchemas {
11
11
  baseUrl?: core.Supplier<string>;
12
12
  apiKey?: core.Supplier<core.BearerToken | undefined>;
13
13
  /** Additional headers to include in requests. */
14
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
14
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
15
15
  fetcher?: core.FetchFunction;
16
16
  }
17
17
  interface RequestOptions {
@@ -24,7 +24,7 @@ export declare namespace ExtractionSchemas {
24
24
  /** Additional query string parameters to include in the request. */
25
25
  queryParams?: Record<string, unknown>;
26
26
  /** Additional headers to include in the request. */
27
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
27
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
28
28
  }
29
29
  }
30
30
  export declare class ExtractionSchemas {
@@ -11,7 +11,7 @@ export declare namespace Projects {
11
11
  baseUrl?: core.Supplier<string>;
12
12
  apiKey?: core.Supplier<core.BearerToken | undefined>;
13
13
  /** Additional headers to include in requests. */
14
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
14
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
15
15
  fetcher?: core.FetchFunction;
16
16
  }
17
17
  interface RequestOptions {
@@ -24,7 +24,7 @@ export declare namespace Projects {
24
24
  /** Additional query string parameters to include in the request. */
25
25
  queryParams?: Record<string, unknown>;
26
26
  /** Additional headers to include in the request. */
27
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
27
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
28
28
  }
29
29
  }
30
30
  export declare class Projects {
@@ -11,7 +11,7 @@ export declare namespace Tools {
11
11
  baseUrl?: core.Supplier<string>;
12
12
  apiKey?: core.Supplier<core.BearerToken | undefined>;
13
13
  /** Additional headers to include in requests. */
14
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
14
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
15
15
  fetcher?: core.FetchFunction;
16
16
  }
17
17
  interface RequestOptions {
@@ -24,7 +24,7 @@ export declare namespace Tools {
24
24
  /** Additional query string parameters to include in the request. */
25
25
  queryParams?: Record<string, unknown>;
26
26
  /** Additional headers to include in the request. */
27
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
27
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
28
28
  }
29
29
  }
30
30
  export declare class Tools {
@@ -11,7 +11,7 @@ export declare namespace Voices {
11
11
  baseUrl?: core.Supplier<string>;
12
12
  apiKey?: core.Supplier<core.BearerToken | undefined>;
13
13
  /** Additional headers to include in requests. */
14
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
14
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
15
15
  fetcher?: core.FetchFunction;
16
16
  }
17
17
  interface RequestOptions {
@@ -24,7 +24,7 @@ export declare namespace Voices {
24
24
  /** Additional query string parameters to include in the request. */
25
25
  queryParams?: Record<string, unknown>;
26
26
  /** Additional headers to include in the request. */
27
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
27
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
28
28
  }
29
29
  }
30
30
  export declare class Voices {
@@ -21,6 +21,8 @@ export interface Agent {
21
21
  audio_speed: number;
22
22
  /** The background noise level of the agent. Must be between 0 and 1. */
23
23
  background_noise_level: number;
24
+ /** The background noise type. Can be "office", "call-center", "coffee-shop", or null. */
25
+ background_noise: Agent.BackgroundNoise | null;
24
26
  /** Message to play when the conversation starts. */
25
27
  welcome_message: string | null;
26
28
  /** Instructions for the conversation. */
@@ -38,7 +40,7 @@ export interface Agent {
38
40
  /** Seconds of silence before ending the conversation. */
39
41
  no_input_end_conversation_sec: number;
40
42
  /** Array of ISO 639-1 language codes that the agent should be able to recognize */
41
- recognized_languages: string[];
43
+ languages: Phonic.LanguageCode[];
42
44
  /** These words, or short phrases, will be more accurately recognized by the agent. */
43
45
  boosted_keywords: string[];
44
46
  /** When not `null`, the agent will call this endpoint to get configuration options. */
@@ -62,6 +64,15 @@ export declare namespace Agent {
62
64
  readonly Pcm8000: "pcm_8000";
63
65
  readonly Mulaw8000: "mulaw_8000";
64
66
  };
67
+ /**
68
+ * The background noise type. Can be "office", "call-center", "coffee-shop", or null.
69
+ */
70
+ type BackgroundNoise = "office" | "call-center" | "coffee-shop";
71
+ const BackgroundNoise: {
72
+ readonly Office: "office";
73
+ readonly CallCenter: "call-center";
74
+ readonly CoffeeShop: "coffee-shop";
75
+ };
65
76
  namespace TemplateVariables {
66
77
  interface Value {
67
78
  default_value: string | null;
@@ -9,4 +9,9 @@ export var Agent;
9
9
  Pcm8000: "pcm_8000",
10
10
  Mulaw8000: "mulaw_8000",
11
11
  };
12
+ Agent.BackgroundNoise = {
13
+ Office: "office",
14
+ CallCenter: "call-center",
15
+ CoffeeShop: "coffee-shop",
16
+ };
12
17
  })(Agent || (Agent = {}));
@@ -15,6 +15,8 @@ export interface ConfigPayload {
15
15
  audio_speed?: number;
16
16
  /** Background noise level for the conversation */
17
17
  background_noise_level?: number;
18
+ /** Background noise type for the conversation */
19
+ background_noise?: ConfigPayload.BackgroundNoise | null;
18
20
  /** Message to play when conversation starts */
19
21
  welcome_message?: string | null;
20
22
  /** Voice ID to use for speech synthesis */
@@ -51,6 +53,15 @@ export interface ConfigPayload {
51
53
  template_variables?: Record<string, string>;
52
54
  }
53
55
  export declare namespace ConfigPayload {
56
+ /**
57
+ * Background noise type for the conversation
58
+ */
59
+ type BackgroundNoise = "office" | "call-center" | "coffee-shop";
60
+ const BackgroundNoise: {
61
+ readonly Office: "office";
62
+ readonly CallCenter: "call-center";
63
+ readonly CoffeeShop: "coffee-shop";
64
+ };
54
65
  /**
55
66
  * Audio input format
56
67
  */
@@ -3,6 +3,11 @@
3
3
  */
4
4
  export var ConfigPayload;
5
5
  (function (ConfigPayload) {
6
+ ConfigPayload.BackgroundNoise = {
7
+ Office: "office",
8
+ CallCenter: "call-center",
9
+ CoffeeShop: "coffee-shop",
10
+ };
6
11
  ConfigPayload.InputFormat = {
7
12
  Pcm44100: "pcm_44100",
8
13
  Pcm16000: "pcm_16000",
@@ -25,6 +25,8 @@ export interface Conversation {
25
25
  output_format: string;
26
26
  /** Background noise level used in the conversation. */
27
27
  background_noise_level: number;
28
+ /** The background noise type used in the conversation. */
29
+ background_noise: Conversation.BackgroundNoise | null;
28
30
  /** Live transcript of the conversation. */
29
31
  live_transcript: string;
30
32
  /** Post-call processed transcript. */
@@ -39,10 +41,20 @@ export interface Conversation {
39
41
  ended_at: string | null;
40
42
  /** Who or what ended the conversation. */
41
43
  ended_by: Conversation.EndedBy | null;
42
- /** Array of conversation items (turns). */
43
- items: Phonic.ConversationItem[];
44
+ /** These words, or short phrases, are more accurately recognized by the model. */
45
+ boosted_keywords: string[] | null;
46
+ /** Array of ISO 639-1 language codes recognized by the model. */
47
+ languages: string[] | null;
48
+ /** Number of seconds of silence before a poke message is sent. `null` means the poke message is disabled. */
49
+ no_input_poke_sec: number | null;
50
+ /** The message to send after the specified silence. Relevant only if `no_input_poke_sec` is not `null`. */
51
+ no_input_poke_text: string | null;
52
+ /** Seconds of silence before the conversation is ended. */
53
+ no_input_end_conversation_sec: number | null;
44
54
  /** Results from conversation evaluations and extractions. */
45
55
  task_results: Record<string, unknown>;
56
+ /** Array of conversation items (turns). */
57
+ items: Phonic.ConversationItem[];
46
58
  }
47
59
  export declare namespace Conversation {
48
60
  /**
@@ -65,6 +77,15 @@ export declare namespace Conversation {
65
77
  /** The name of the project. */
66
78
  name: string;
67
79
  }
80
+ /**
81
+ * The background noise type used in the conversation.
82
+ */
83
+ type BackgroundNoise = "office" | "call-center" | "coffee-shop";
84
+ const BackgroundNoise: {
85
+ readonly Office: "office";
86
+ readonly CallCenter: "call-center";
87
+ readonly CoffeeShop: "coffee-shop";
88
+ };
68
89
  /**
69
90
  * Who or what ended the conversation.
70
91
  */
@@ -3,6 +3,11 @@
3
3
  */
4
4
  export var Conversation;
5
5
  (function (Conversation) {
6
+ Conversation.BackgroundNoise = {
7
+ Office: "office",
8
+ CallCenter: "call-center",
9
+ CoffeeShop: "coffee-shop",
10
+ };
6
11
  Conversation.EndedBy = {
7
12
  User: "user",
8
13
  UserCanceled: "user_canceled",
@@ -16,6 +16,8 @@ export interface CreateAgentRequest {
16
16
  audio_speed?: number;
17
17
  /** The background noise level of the agent. */
18
18
  background_noise_level?: number;
19
+ /** The background noise type. Can be "office", "call-center", "coffee-shop", or null. */
20
+ background_noise?: CreateAgentRequest.BackgroundNoise | null;
19
21
  /** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. */
20
22
  welcome_message?: string;
21
23
  /** Instructions for the conversation. Can contain template variables like `{{subject}}`. */
@@ -33,7 +35,7 @@ export interface CreateAgentRequest {
33
35
  /** Seconds of silence before ending the conversation. */
34
36
  no_input_end_conversation_sec?: number;
35
37
  /** Array of ISO 639-1 language codes that the agent should be able to recognize */
36
- recognized_languages?: string[];
38
+ languages?: Phonic.LanguageCode[];
37
39
  /** These words, or short phrases, will be more accurately recognized by the agent. */
38
40
  boosted_keywords?: string[];
39
41
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint when to get configuration options. */
@@ -50,6 +52,15 @@ export declare namespace CreateAgentRequest {
50
52
  readonly Pcm8000: "pcm_8000";
51
53
  readonly Mulaw8000: "mulaw_8000";
52
54
  };
55
+ /**
56
+ * The background noise type. Can be "office", "call-center", "coffee-shop", or null.
57
+ */
58
+ type BackgroundNoise = "office" | "call-center" | "coffee-shop";
59
+ const BackgroundNoise: {
60
+ readonly Office: "office";
61
+ readonly CallCenter: "call-center";
62
+ readonly CoffeeShop: "coffee-shop";
63
+ };
53
64
  namespace TemplateVariables {
54
65
  interface Value {
55
66
  default_value: string | null;
@@ -9,4 +9,9 @@ export var CreateAgentRequest;
9
9
  Pcm8000: "pcm_8000",
10
10
  Mulaw8000: "mulaw_8000",
11
11
  };
12
+ CreateAgentRequest.BackgroundNoise = {
13
+ Office: "office",
14
+ CallCenter: "call-center",
15
+ CoffeeShop: "coffee-shop",
16
+ };
12
17
  })(CreateAgentRequest || (CreateAgentRequest = {}));
@@ -0,0 +1,28 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * ISO 639-1 language codes supported by the agent
6
+ */
7
+ export type LanguageCode = "ar" | "zh" | "cs" | "da" | "nl" | "en" | "fr" | "de" | "id" | "it" | "ja" | "ko" | "pl" | "pt" | "ru" | "es" | "sv" | "tr" | "vi";
8
+ export declare const LanguageCode: {
9
+ readonly Ar: "ar";
10
+ readonly Zh: "zh";
11
+ readonly Cs: "cs";
12
+ readonly Da: "da";
13
+ readonly Nl: "nl";
14
+ readonly En: "en";
15
+ readonly Fr: "fr";
16
+ readonly De: "de";
17
+ readonly Id: "id";
18
+ readonly It: "it";
19
+ readonly Ja: "ja";
20
+ readonly Ko: "ko";
21
+ readonly Pl: "pl";
22
+ readonly Pt: "pt";
23
+ readonly Ru: "ru";
24
+ readonly Es: "es";
25
+ readonly Sv: "sv";
26
+ readonly Tr: "tr";
27
+ readonly Vi: "vi";
28
+ };