phonic 0.30.8 → 0.30.10

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 (83) hide show
  1. package/README.md +4 -2
  2. package/dist/cjs/Client.js +2 -2
  3. package/dist/cjs/api/resources/agents/client/Client.d.ts +13 -7
  4. package/dist/cjs/api/resources/agents/client/Client.js +15 -11
  5. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +8 -6
  6. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +11 -8
  7. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +1 -0
  8. package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +4 -2
  9. package/dist/cjs/api/resources/conversations/client/Client.d.ts +2 -2
  10. package/dist/cjs/api/resources/conversations/client/Client.js +4 -6
  11. package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +1 -1
  12. package/dist/cjs/api/resources/extractionSchemas/client/Client.d.ts +1 -1
  13. package/dist/cjs/api/resources/extractionSchemas/client/Client.js +3 -5
  14. package/dist/cjs/api/resources/projects/client/Client.d.ts +1 -1
  15. package/dist/cjs/api/resources/projects/client/Client.js +3 -5
  16. package/dist/cjs/api/resources/projects/client/requests/UpdateProjectRequest.d.ts +1 -1
  17. package/dist/cjs/api/resources/tools/client/Client.d.ts +1 -1
  18. package/dist/cjs/api/resources/tools/client/Client.js +3 -5
  19. package/dist/cjs/api/resources/voices/client/Client.d.ts +1 -1
  20. package/dist/cjs/api/resources/voices/client/Client.js +3 -5
  21. package/dist/cjs/api/types/Agent.d.ts +8 -7
  22. package/dist/cjs/api/types/Agent.js +1 -0
  23. package/dist/cjs/api/types/ConfigPayload.d.ts +6 -4
  24. package/dist/cjs/api/types/ConfigPayload.js +2 -0
  25. package/dist/cjs/api/types/Conversation.d.ts +30 -9
  26. package/dist/cjs/api/types/Conversation.js +11 -0
  27. package/dist/cjs/api/types/ConversationExtraction.d.ts +1 -1
  28. package/dist/cjs/api/types/ConversationItem.d.ts +13 -13
  29. package/dist/cjs/api/types/CreateAgentRequest.d.ts +7 -6
  30. package/dist/cjs/api/types/CreateAgentRequest.js +1 -0
  31. package/dist/cjs/api/types/ExtractionField.d.ts +1 -1
  32. package/dist/cjs/api/types/LanguageCode.d.ts +28 -0
  33. package/dist/cjs/api/types/LanguageCode.js +27 -0
  34. package/dist/cjs/api/types/OutboundCallConfig.d.ts +4 -3
  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/api/types/index.d.ts +1 -0
  39. package/dist/cjs/api/types/index.js +1 -0
  40. package/dist/cjs/version.d.ts +1 -1
  41. package/dist/cjs/version.js +1 -1
  42. package/dist/esm/Client.mjs +2 -2
  43. package/dist/esm/api/resources/agents/client/Client.d.mts +13 -7
  44. package/dist/esm/api/resources/agents/client/Client.mjs +15 -11
  45. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +8 -6
  46. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +11 -8
  47. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.mjs +1 -0
  48. package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +4 -2
  49. package/dist/esm/api/resources/conversations/client/Client.d.mts +2 -2
  50. package/dist/esm/api/resources/conversations/client/Client.mjs +4 -6
  51. package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +1 -1
  52. package/dist/esm/api/resources/extractionSchemas/client/Client.d.mts +1 -1
  53. package/dist/esm/api/resources/extractionSchemas/client/Client.mjs +3 -5
  54. package/dist/esm/api/resources/projects/client/Client.d.mts +1 -1
  55. package/dist/esm/api/resources/projects/client/Client.mjs +3 -5
  56. package/dist/esm/api/resources/projects/client/requests/UpdateProjectRequest.d.mts +1 -1
  57. package/dist/esm/api/resources/tools/client/Client.d.mts +1 -1
  58. package/dist/esm/api/resources/tools/client/Client.mjs +3 -5
  59. package/dist/esm/api/resources/voices/client/Client.d.mts +1 -1
  60. package/dist/esm/api/resources/voices/client/Client.mjs +3 -5
  61. package/dist/esm/api/types/Agent.d.mts +8 -7
  62. package/dist/esm/api/types/Agent.mjs +1 -0
  63. package/dist/esm/api/types/ConfigPayload.d.mts +6 -4
  64. package/dist/esm/api/types/ConfigPayload.mjs +2 -0
  65. package/dist/esm/api/types/Conversation.d.mts +30 -9
  66. package/dist/esm/api/types/Conversation.mjs +10 -1
  67. package/dist/esm/api/types/ConversationExtraction.d.mts +1 -1
  68. package/dist/esm/api/types/ConversationItem.d.mts +13 -13
  69. package/dist/esm/api/types/CreateAgentRequest.d.mts +7 -6
  70. package/dist/esm/api/types/CreateAgentRequest.mjs +1 -0
  71. package/dist/esm/api/types/ExtractionField.d.mts +1 -1
  72. package/dist/esm/api/types/LanguageCode.d.mts +28 -0
  73. package/dist/esm/api/types/LanguageCode.mjs +24 -0
  74. package/dist/esm/api/types/OutboundCallConfig.d.mts +4 -3
  75. package/dist/esm/api/types/Project.d.mts +1 -1
  76. package/dist/esm/api/types/ToolCallOutputProcessedPayload.d.mts +8 -8
  77. package/dist/esm/api/types/Voice.d.mts +1 -1
  78. package/dist/esm/api/types/index.d.mts +1 -0
  79. package/dist/esm/api/types/index.mjs +1 -0
  80. package/dist/esm/version.d.mts +1 -1
  81. package/dist/esm/version.mjs +1 -1
  82. package/package.json +2 -2
  83. package/reference.md +13 -7
@@ -15,7 +15,9 @@ import * as Phonic from "../../../../index.mjs";
15
15
  * welcome_message: "Hi {{customer_name}}. How can I help you today?",
16
16
  * system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
17
17
  * template_variables: {
18
- * "customer_name": {},
18
+ * "customer_name": {
19
+ * default_value: null
20
+ * },
19
21
  * "subject": {
20
22
  * default_value: "Chess"
21
23
  * }
@@ -23,7 +25,7 @@ import * as Phonic from "../../../../index.mjs";
23
25
  * tools: ["keypad_input"],
24
26
  * no_input_poke_sec: 30,
25
27
  * no_input_poke_text: "Are you still there?",
26
- * recognized_languages: ["en", "es"],
28
+ * languages: ["en", "es"],
27
29
  * boosted_keywords: ["Load ID", "dispatch"],
28
30
  * configuration_endpoint: {
29
31
  * url: "https://api.example.com/config",
@@ -39,7 +41,7 @@ export interface UpdateAgentRequest {
39
41
  project?: string;
40
42
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
41
43
  name?: string;
42
- phone_number?: "assign-automatically";
44
+ phone_number?: "assign-automatically" | null;
43
45
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
44
46
  timezone?: string;
45
47
  /** The voice ID to use. */
@@ -61,31 +63,32 @@ export interface UpdateAgentRequest {
61
63
  /** Array of task objects with `name` and `description` fields. */
62
64
  tasks?: Phonic.Task[];
63
65
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
64
- no_input_poke_sec?: number;
66
+ no_input_poke_sec?: number | null;
65
67
  /** The message to send after the specified silence. */
66
68
  no_input_poke_text?: string;
67
69
  /** Seconds of silence before ending the conversation. */
68
70
  no_input_end_conversation_sec?: number;
69
71
  /** Array of ISO 639-1 language codes that the agent should be able to recognize */
70
- recognized_languages?: string[];
72
+ languages?: Phonic.LanguageCode[];
71
73
  /** These words, or short phrases, will be more accurately recognized by the agent. */
72
74
  boosted_keywords?: string[];
73
75
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint when to get configuration options. */
74
- configuration_endpoint?: UpdateAgentRequest.ConfigurationEndpoint;
76
+ configuration_endpoint?: UpdateAgentRequest.ConfigurationEndpoint | null;
75
77
  }
76
78
  export declare namespace UpdateAgentRequest {
77
79
  /**
78
80
  * The audio format of the agent.
79
81
  */
80
- type AudioFormat = "pcm_44100" | "pcm_16000" | "mulaw_8000";
82
+ type AudioFormat = "pcm_44100" | "pcm_16000" | "pcm_8000" | "mulaw_8000";
81
83
  const AudioFormat: {
82
84
  readonly Pcm44100: "pcm_44100";
83
85
  readonly Pcm16000: "pcm_16000";
86
+ readonly Pcm8000: "pcm_8000";
84
87
  readonly Mulaw8000: "mulaw_8000";
85
88
  };
86
89
  namespace TemplateVariables {
87
90
  interface Value {
88
- default_value?: string;
91
+ default_value: string | null;
89
92
  is_boosted_keyword?: boolean;
90
93
  }
91
94
  }
@@ -6,6 +6,7 @@ export var UpdateAgentRequest;
6
6
  UpdateAgentRequest.AudioFormat = {
7
7
  Pcm44100: "pcm_44100",
8
8
  Pcm16000: "pcm_16000",
9
+ Pcm8000: "pcm_8000",
9
10
  Mulaw8000: "mulaw_8000",
10
11
  };
11
12
  })(UpdateAgentRequest || (UpdateAgentRequest = {}));
@@ -15,7 +15,9 @@ import * as Phonic from "../../../../index.mjs";
15
15
  * welcome_message: "Hi {{customer_name}}. How can I help you today?",
16
16
  * system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
17
17
  * template_variables: {
18
- * "customer_name": {},
18
+ * "customer_name": {
19
+ * default_value: null
20
+ * },
19
21
  * "subject": {
20
22
  * default_value: "Chess"
21
23
  * }
@@ -23,7 +25,7 @@ import * as Phonic from "../../../../index.mjs";
23
25
  * tools: ["keypad_input"],
24
26
  * no_input_poke_sec: 30,
25
27
  * no_input_poke_text: "Are you still there?",
26
- * recognized_languages: ["en", "es"],
28
+ * languages: ["en", "es"],
27
29
  * boosted_keywords: ["Load ID", "dispatch"],
28
30
  * configuration_endpoint: {
29
31
  * url: "https://api.example.com/config",
@@ -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
  * }
@@ -233,5 +233,5 @@ export declare class Conversations {
233
233
  sipOutboundCall(request: Phonic.ConversationsSipOutboundCallRequest, requestOptions?: Conversations.RequestOptions): core.HttpResponsePromise<Phonic.ConversationsSipOutboundCallResponse>;
234
234
  private __sipOutboundCall;
235
235
  connect(args?: Conversations.ConnectArgs): Promise<ConversationsSocket>;
236
- protected _getAuthorizationHeader(): Promise<string>;
236
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
237
237
  }
@@ -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
  * }
@@ -857,12 +857,10 @@ export class Conversations {
857
857
  return __awaiter(this, void 0, void 0, function* () {
858
858
  var _a;
859
859
  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"];
860
- if (bearer == null) {
861
- throw new errors.PhonicError({
862
- message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
863
- });
860
+ if (bearer != null) {
861
+ return `Bearer ${bearer}`;
864
862
  }
865
- return `Bearer ${bearer}`;
863
+ return undefined;
866
864
  });
867
865
  }
868
866
  }
@@ -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
  * }
@@ -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,17 +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
40
  /** Array of ISO 639-1 language codes that the agent should be able to recognize */
41
- recognized_languages: string[];
41
+ languages: Phonic.LanguageCode[];
42
42
  /** These words, or short phrases, will be more accurately recognized by the agent. */
43
43
  boosted_keywords: string[];
44
44
  /** When not `null`, the agent will call this endpoint to get configuration options. */
45
- configuration_endpoint?: Agent.ConfigurationEndpoint;
45
+ configuration_endpoint: Agent.ConfigurationEndpoint | null;
46
46
  }
47
47
  export declare namespace Agent {
48
48
  /**
@@ -55,15 +55,16 @@ export declare namespace Agent {
55
55
  /**
56
56
  * The audio format of the agent. If the agent has a phone number, the audio format will be `mulaw_8000`.
57
57
  */
58
- type AudioFormat = "pcm_44100" | "pcm_16000" | "mulaw_8000";
58
+ type AudioFormat = "pcm_44100" | "pcm_16000" | "pcm_8000" | "mulaw_8000";
59
59
  const AudioFormat: {
60
60
  readonly Pcm44100: "pcm_44100";
61
61
  readonly Pcm16000: "pcm_16000";
62
+ readonly Pcm8000: "pcm_8000";
62
63
  readonly Mulaw8000: "mulaw_8000";
63
64
  };
64
65
  namespace TemplateVariables {
65
66
  interface Value {
66
- default_value?: string;
67
+ default_value: string | null;
67
68
  }
68
69
  }
69
70
  type Tools = Tools.Item[];
@@ -6,6 +6,7 @@ export var Agent;
6
6
  Agent.AudioFormat = {
7
7
  Pcm44100: "pcm_44100",
8
8
  Pcm16000: "pcm_16000",
9
+ Pcm8000: "pcm_8000",
9
10
  Mulaw8000: "mulaw_8000",
10
11
  };
11
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,7 +36,7 @@ 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 */
@@ -54,19 +54,21 @@ export declare namespace ConfigPayload {
54
54
  /**
55
55
  * Audio input format
56
56
  */
57
- type InputFormat = "pcm_44100" | "pcm_16000" | "mulaw_8000";
57
+ type InputFormat = "pcm_44100" | "pcm_16000" | "pcm_8000" | "mulaw_8000";
58
58
  const InputFormat: {
59
59
  readonly Pcm44100: "pcm_44100";
60
60
  readonly Pcm16000: "pcm_16000";
61
+ readonly Pcm8000: "pcm_8000";
61
62
  readonly Mulaw8000: "mulaw_8000";
62
63
  };
63
64
  /**
64
65
  * Audio output format
65
66
  */
66
- type OutputFormat = "pcm_44100" | "pcm_16000" | "mulaw_8000";
67
+ type OutputFormat = "pcm_44100" | "pcm_16000" | "pcm_8000" | "mulaw_8000";
67
68
  const OutputFormat: {
68
69
  readonly Pcm44100: "pcm_44100";
69
70
  readonly Pcm16000: "pcm_16000";
71
+ readonly Pcm8000: "pcm_8000";
70
72
  readonly Mulaw8000: "mulaw_8000";
71
73
  };
72
74
  }
@@ -6,11 +6,13 @@ export var ConfigPayload;
6
6
  ConfigPayload.InputFormat = {
7
7
  Pcm44100: "pcm_44100",
8
8
  Pcm16000: "pcm_16000",
9
+ Pcm8000: "pcm_8000",
9
10
  Mulaw8000: "mulaw_8000",
10
11
  };
11
12
  ConfigPayload.OutputFormat = {
12
13
  Pcm44100: "pcm_44100",
13
14
  Pcm16000: "pcm_16000",
15
+ Pcm8000: "pcm_8000",
14
16
  Mulaw8000: "mulaw_8000",
15
17
  };
16
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,21 +28,31 @@ 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
40
  /** Who or what ended the conversation. */
41
- ended_by?: string;
42
- /** Array of conversation items (turns). */
43
- items: Phonic.ConversationItem[];
41
+ ended_by: Conversation.EndedBy | null;
42
+ /** These words, or short phrases, are more accurately recognized by the model. */
43
+ boosted_keywords: string[] | null;
44
+ /** Array of ISO 639-1 language codes recognized by the model. */
45
+ languages: string[] | null;
46
+ /** Number of seconds of silence before a poke message is sent. `null` means the poke message is disabled. */
47
+ no_input_poke_sec: number | null;
48
+ /** The message to send after the specified silence. Relevant only if `no_input_poke_sec` is not `null`. */
49
+ no_input_poke_text: string | null;
50
+ /** Seconds of silence before the conversation is ended. */
51
+ no_input_end_conversation_sec: number | null;
44
52
  /** Results from conversation evaluations and extractions. */
45
53
  task_results: Record<string, unknown>;
54
+ /** Array of conversation items (turns). */
55
+ items: Phonic.ConversationItem[];
46
56
  }
47
57
  export declare namespace Conversation {
48
58
  /**
@@ -65,4 +75,15 @@ export declare namespace Conversation {
65
75
  /** The name of the project. */
66
76
  name: string;
67
77
  }
78
+ /**
79
+ * Who or what ended the conversation.
80
+ */
81
+ type EndedBy = "user" | "user_canceled" | "user_validation_failed" | "assistant" | "error";
82
+ const EndedBy: {
83
+ readonly User: "user";
84
+ readonly UserCanceled: "user_canceled";
85
+ readonly UserValidationFailed: "user_validation_failed";
86
+ readonly Assistant: "assistant";
87
+ readonly Error: "error";
88
+ };
68
89
  }
@@ -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,31 +27,32 @@ 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
35
  /** Array of ISO 639-1 language codes that the agent should be able to recognize */
36
- recognized_languages?: string[];
36
+ languages?: Phonic.LanguageCode[];
37
37
  /** These words, or short phrases, will be more accurately recognized by the agent. */
38
38
  boosted_keywords?: string[];
39
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. */
40
- configuration_endpoint?: CreateAgentRequest.ConfigurationEndpoint;
40
+ configuration_endpoint?: CreateAgentRequest.ConfigurationEndpoint | null;
41
41
  }
42
42
  export declare namespace CreateAgentRequest {
43
43
  /**
44
44
  * The audio format of the agent.
45
45
  */
46
- type AudioFormat = "pcm_44100" | "pcm_16000" | "mulaw_8000";
46
+ type AudioFormat = "pcm_44100" | "pcm_16000" | "pcm_8000" | "mulaw_8000";
47
47
  const AudioFormat: {
48
48
  readonly Pcm44100: "pcm_44100";
49
49
  readonly Pcm16000: "pcm_16000";
50
+ readonly Pcm8000: "pcm_8000";
50
51
  readonly Mulaw8000: "mulaw_8000";
51
52
  };
52
53
  namespace TemplateVariables {
53
54
  interface Value {
54
- default_value?: string;
55
+ default_value: string | null;
55
56
  is_boosted_keyword?: boolean;
56
57
  }
57
58
  }
@@ -6,6 +6,7 @@ export var CreateAgentRequest;
6
6
  CreateAgentRequest.AudioFormat = {
7
7
  Pcm44100: "pcm_44100",
8
8
  Pcm16000: "pcm_16000",
9
+ Pcm8000: "pcm_8000",
9
10
  Mulaw8000: "mulaw_8000",
10
11
  };
11
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
  /**
@@ -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
+ };