phonic 0.30.4 → 0.30.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.
package/README.md CHANGED
@@ -25,31 +25,29 @@ import { PhonicClient } from "phonic";
25
25
  const client = new PhonicClient({ apiKey: "YOUR_API_KEY" });
26
26
  await client.agents.create({
27
27
  project: "main",
28
- body: {
29
- name: "support-agent",
30
- phone_number: "assign-automatically",
31
- timezone: "America/Los_Angeles",
32
- voice_id: "grant",
33
- audio_speed: 1,
34
- welcome_message: "Hi {{customer_name}}. How can I help you today?",
35
- system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
36
- template_variables: {
37
- customer_name: {},
38
- subject: {
39
- default_value: "Chess",
40
- },
28
+ name: "support-agent",
29
+ phone_number: "assign-automatically",
30
+ timezone: "America/Los_Angeles",
31
+ voice_id: "grant",
32
+ audio_speed: 1,
33
+ welcome_message: "Hi {{customer_name}}. How can I help you today?",
34
+ system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
35
+ template_variables: {
36
+ customer_name: {},
37
+ subject: {
38
+ default_value: "Chess",
41
39
  },
42
- tools: ["keypad_input"],
43
- no_input_poke_sec: 30,
44
- no_input_poke_text: "Are you still there?",
45
- boosted_keywords: ["Load ID", "dispatch"],
46
- configuration_endpoint: {
47
- url: "https://api.example.com/config",
48
- headers: {
49
- Authorization: "Bearer token123",
50
- },
51
- timeout_ms: 7000,
40
+ },
41
+ tools: ["keypad_input"],
42
+ no_input_poke_sec: 30,
43
+ no_input_poke_text: "Are you still there?",
44
+ boosted_keywords: ["Load ID", "dispatch"],
45
+ configuration_endpoint: {
46
+ url: "https://api.example.com/config",
47
+ headers: {
48
+ Authorization: "Bearer token123",
52
49
  },
50
+ timeout_ms: 7000,
53
51
  },
54
52
  });
55
53
  ```
@@ -50,8 +50,8 @@ class PhonicClient {
50
50
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
51
51
  "X-Fern-Language": "JavaScript",
52
52
  "X-Fern-SDK-Name": "phonic",
53
- "X-Fern-SDK-Version": "0.30.4",
54
- "User-Agent": "phonic/0.30.4",
53
+ "X-Fern-SDK-Version": "0.30.6",
54
+ "User-Agent": "phonic/0.30.6",
55
55
  "X-Fern-Runtime": core.RUNTIME.type,
56
56
  "X-Fern-Runtime-Version": core.RUNTIME.version,
57
57
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -58,31 +58,29 @@ export declare class Agents {
58
58
  * @example
59
59
  * await client.agents.create({
60
60
  * project: "main",
61
- * body: {
62
- * name: "support-agent",
63
- * phone_number: "assign-automatically",
64
- * timezone: "America/Los_Angeles",
65
- * voice_id: "grant",
66
- * audio_speed: 1,
67
- * welcome_message: "Hi {{customer_name}}. How can I help you today?",
68
- * system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
69
- * template_variables: {
70
- * "customer_name": {},
71
- * "subject": {
72
- * default_value: "Chess"
73
- * }
74
- * },
75
- * tools: ["keypad_input"],
76
- * no_input_poke_sec: 30,
77
- * no_input_poke_text: "Are you still there?",
78
- * boosted_keywords: ["Load ID", "dispatch"],
79
- * configuration_endpoint: {
80
- * url: "https://api.example.com/config",
81
- * headers: {
82
- * "Authorization": "Bearer token123"
83
- * },
84
- * timeout_ms: 7000
61
+ * name: "support-agent",
62
+ * phone_number: "assign-automatically",
63
+ * timezone: "America/Los_Angeles",
64
+ * voice_id: "grant",
65
+ * audio_speed: 1,
66
+ * welcome_message: "Hi {{customer_name}}. How can I help you today?",
67
+ * system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
68
+ * template_variables: {
69
+ * "customer_name": {},
70
+ * "subject": {
71
+ * default_value: "Chess"
85
72
  * }
73
+ * },
74
+ * tools: ["keypad_input"],
75
+ * no_input_poke_sec: 30,
76
+ * no_input_poke_text: "Are you still there?",
77
+ * boosted_keywords: ["Load ID", "dispatch"],
78
+ * configuration_endpoint: {
79
+ * url: "https://api.example.com/config",
80
+ * headers: {
81
+ * "Authorization": "Bearer token123"
82
+ * },
83
+ * timeout_ms: 7000
86
84
  * }
87
85
  * })
88
86
  */
@@ -148,31 +148,29 @@ class Agents {
148
148
  * @example
149
149
  * await client.agents.create({
150
150
  * project: "main",
151
- * body: {
152
- * name: "support-agent",
153
- * phone_number: "assign-automatically",
154
- * timezone: "America/Los_Angeles",
155
- * voice_id: "grant",
156
- * audio_speed: 1,
157
- * welcome_message: "Hi {{customer_name}}. How can I help you today?",
158
- * system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
159
- * template_variables: {
160
- * "customer_name": {},
161
- * "subject": {
162
- * default_value: "Chess"
163
- * }
164
- * },
165
- * tools: ["keypad_input"],
166
- * no_input_poke_sec: 30,
167
- * no_input_poke_text: "Are you still there?",
168
- * boosted_keywords: ["Load ID", "dispatch"],
169
- * configuration_endpoint: {
170
- * url: "https://api.example.com/config",
171
- * headers: {
172
- * "Authorization": "Bearer token123"
173
- * },
174
- * timeout_ms: 7000
151
+ * name: "support-agent",
152
+ * phone_number: "assign-automatically",
153
+ * timezone: "America/Los_Angeles",
154
+ * voice_id: "grant",
155
+ * audio_speed: 1,
156
+ * welcome_message: "Hi {{customer_name}}. How can I help you today?",
157
+ * system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
158
+ * template_variables: {
159
+ * "customer_name": {},
160
+ * "subject": {
161
+ * default_value: "Chess"
175
162
  * }
163
+ * },
164
+ * tools: ["keypad_input"],
165
+ * no_input_poke_sec: 30,
166
+ * no_input_poke_text: "Are you still there?",
167
+ * boosted_keywords: ["Load ID", "dispatch"],
168
+ * configuration_endpoint: {
169
+ * url: "https://api.example.com/config",
170
+ * headers: {
171
+ * "Authorization": "Bearer token123"
172
+ * },
173
+ * timeout_ms: 7000
176
174
  * }
177
175
  * })
178
176
  */
@@ -182,7 +180,7 @@ class Agents {
182
180
  __create(request, requestOptions) {
183
181
  return __awaiter(this, void 0, void 0, function* () {
184
182
  var _a, _b, _c, _d;
185
- const { project, body: _body } = request;
183
+ const { project } = request, _body = __rest(request, ["project"]);
186
184
  const _queryParams = {};
187
185
  if (project != null) {
188
186
  _queryParams["project"] = project;
@@ -6,36 +6,64 @@ import * as Phonic from "../../../../index.js";
6
6
  * @example
7
7
  * {
8
8
  * project: "main",
9
- * body: {
10
- * name: "support-agent",
11
- * phone_number: "assign-automatically",
12
- * timezone: "America/Los_Angeles",
13
- * voice_id: "grant",
14
- * audio_speed: 1,
15
- * welcome_message: "Hi {{customer_name}}. How can I help you today?",
16
- * system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
17
- * template_variables: {
18
- * "customer_name": {},
19
- * "subject": {
20
- * default_value: "Chess"
21
- * }
22
- * },
23
- * tools: ["keypad_input"],
24
- * no_input_poke_sec: 30,
25
- * no_input_poke_text: "Are you still there?",
26
- * boosted_keywords: ["Load ID", "dispatch"],
27
- * configuration_endpoint: {
28
- * url: "https://api.example.com/config",
29
- * headers: {
30
- * "Authorization": "Bearer token123"
31
- * },
32
- * timeout_ms: 7000
9
+ * name: "support-agent",
10
+ * phone_number: "assign-automatically",
11
+ * timezone: "America/Los_Angeles",
12
+ * voice_id: "grant",
13
+ * audio_speed: 1,
14
+ * welcome_message: "Hi {{customer_name}}. How can I help you today?",
15
+ * system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
16
+ * template_variables: {
17
+ * "customer_name": {},
18
+ * "subject": {
19
+ * default_value: "Chess"
33
20
  * }
21
+ * },
22
+ * tools: ["keypad_input"],
23
+ * no_input_poke_sec: 30,
24
+ * no_input_poke_text: "Are you still there?",
25
+ * boosted_keywords: ["Load ID", "dispatch"],
26
+ * configuration_endpoint: {
27
+ * url: "https://api.example.com/config",
28
+ * headers: {
29
+ * "Authorization": "Bearer token123"
30
+ * },
31
+ * timeout_ms: 7000
34
32
  * }
35
33
  * }
36
34
  */
37
35
  export interface AgentsCreateRequest {
38
36
  /** The name of the project to create the agent in. */
39
37
  project?: string;
40
- body: Phonic.CreateAgentRequest;
38
+ /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
39
+ name: string;
40
+ phone_number?: "assign-automatically";
41
+ /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
42
+ timezone?: string;
43
+ /** The voice ID to use. */
44
+ voice_id?: string;
45
+ /** The audio format of the agent. */
46
+ audio_format?: Phonic.CreateAgentRequest.AudioFormat;
47
+ /** The audio speed of the agent. */
48
+ audio_speed?: number;
49
+ /** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. */
50
+ welcome_message?: string;
51
+ /** Instructions for the conversation. Can contain template variables like `{{subject}}`. */
52
+ system_prompt?: string;
53
+ /** Variables that can be used in the welcome message and the system prompt. */
54
+ template_variables?: Record<string, Phonic.CreateAgentRequest.TemplateVariables.Value>;
55
+ /** Array of built-in or custom tool names to use. */
56
+ tools?: Phonic.CreateAgentRequest.Tools.Item[];
57
+ /** Array of task objects with `name` and `description` fields. */
58
+ tasks?: Phonic.Task[];
59
+ /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
60
+ no_input_poke_sec?: number;
61
+ /** The message to send after the specified silence. */
62
+ no_input_poke_text?: string;
63
+ /** Seconds of silence before ending the conversation. */
64
+ no_input_end_conversation_sec?: number;
65
+ /** These words, or short phrases, will be more accurately recognized by the agent. */
66
+ boosted_keywords?: string[];
67
+ /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint when to get configuration options. */
68
+ configuration_endpoint?: Phonic.CreateAgentRequest.ConfigurationEndpoint;
41
69
  }
@@ -201,7 +201,7 @@ export declare class Conversations {
201
201
  * "customer_name": "David",
202
202
  * "subject": "Chess"
203
203
  * },
204
- * voice_id: "sarah",
204
+ * voice_id: "grant",
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,
@@ -117,11 +117,12 @@ class Conversations {
117
117
  if (limit != null) {
118
118
  _queryParams["limit"] = limit.toString();
119
119
  }
120
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
121
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PhonicEnvironment.Default)
120
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
121
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
122
+ url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
122
123
  .base, "conversations"),
123
124
  method: "GET",
124
- headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
125
+ headers: _headers,
125
126
  queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
126
127
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
127
128
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
@@ -187,11 +188,12 @@ class Conversations {
187
188
  __get(id, requestOptions) {
188
189
  return __awaiter(this, void 0, void 0, function* () {
189
190
  var _a, _b, _c, _d;
190
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
191
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PhonicEnvironment.Default)
191
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
192
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
193
+ url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
192
194
  .base, `conversations/${encodeURIComponent(id)}`),
193
195
  method: "GET",
194
- headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
196
+ headers: _headers,
195
197
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
196
198
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
197
199
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
@@ -257,11 +259,12 @@ class Conversations {
257
259
  __cancel(id, requestOptions) {
258
260
  return __awaiter(this, void 0, void 0, function* () {
259
261
  var _a, _b, _c, _d;
260
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
261
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PhonicEnvironment.Default)
262
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
263
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
264
+ url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
262
265
  .base, `conversations/${encodeURIComponent(id)}/cancel`),
263
266
  method: "POST",
264
- headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
267
+ headers: _headers,
265
268
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
266
269
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
267
270
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
@@ -329,11 +332,12 @@ class Conversations {
329
332
  __getAnalysis(id, requestOptions) {
330
333
  return __awaiter(this, void 0, void 0, function* () {
331
334
  var _a, _b, _c, _d;
332
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
333
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PhonicEnvironment.Default)
335
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
336
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
337
+ url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
334
338
  .base, `conversations/${encodeURIComponent(id)}/analysis`),
335
339
  method: "GET",
336
- headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
340
+ headers: _headers,
337
341
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
338
342
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
339
343
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
@@ -400,11 +404,12 @@ class Conversations {
400
404
  __listExtractions(id, requestOptions) {
401
405
  return __awaiter(this, void 0, void 0, function* () {
402
406
  var _a, _b, _c, _d;
403
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
404
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PhonicEnvironment.Default)
407
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
408
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
409
+ url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
405
410
  .base, `conversations/${encodeURIComponent(id)}/extractions`),
406
411
  method: "GET",
407
- headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
412
+ headers: _headers,
408
413
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
409
414
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
410
415
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
@@ -475,11 +480,12 @@ class Conversations {
475
480
  __extractData(id, request, requestOptions) {
476
481
  return __awaiter(this, void 0, void 0, function* () {
477
482
  var _a, _b, _c, _d;
478
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
479
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PhonicEnvironment.Default)
483
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
484
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
485
+ url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
480
486
  .base, `conversations/${encodeURIComponent(id)}/extractions`),
481
487
  method: "POST",
482
- headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
488
+ headers: _headers,
483
489
  contentType: "application/json",
484
490
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
485
491
  requestType: "json",
@@ -551,11 +557,12 @@ class Conversations {
551
557
  __listEvaluations(id, requestOptions) {
552
558
  return __awaiter(this, void 0, void 0, function* () {
553
559
  var _a, _b, _c, _d;
554
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
555
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PhonicEnvironment.Default)
560
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
561
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
562
+ url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
556
563
  .base, `conversations/${encodeURIComponent(id)}/evals`),
557
564
  method: "GET",
558
- headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
565
+ headers: _headers,
559
566
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
560
567
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
561
568
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
@@ -626,11 +633,12 @@ class Conversations {
626
633
  __evaluate(id, request, requestOptions) {
627
634
  return __awaiter(this, void 0, void 0, function* () {
628
635
  var _a, _b, _c, _d;
629
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
630
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PhonicEnvironment.Default)
636
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
637
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
638
+ url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
631
639
  .base, `conversations/${encodeURIComponent(id)}/evals`),
632
640
  method: "POST",
633
- headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
641
+ headers: _headers,
634
642
  contentType: "application/json",
635
643
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
636
644
  requestType: "json",
@@ -701,7 +709,7 @@ class Conversations {
701
709
  * "customer_name": "David",
702
710
  * "subject": "Chess"
703
711
  * },
704
- * voice_id: "sarah",
712
+ * voice_id: "grant",
705
713
  * no_input_poke_sec: 30,
706
714
  * no_input_poke_text: "Are you still there?",
707
715
  * no_input_end_conversation_sec: 180,
@@ -716,11 +724,12 @@ class Conversations {
716
724
  __outboundCall(request, requestOptions) {
717
725
  return __awaiter(this, void 0, void 0, function* () {
718
726
  var _a, _b, _c, _d;
719
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
720
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PhonicEnvironment.Default)
727
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
728
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
729
+ url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
721
730
  .base, "conversations/outbound_call"),
722
731
  method: "POST",
723
- headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
732
+ headers: _headers,
724
733
  contentType: "application/json",
725
734
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
726
735
  requestType: "json",
@@ -801,16 +810,17 @@ class Conversations {
801
810
  if (downstreamWebsocketUrl != null) {
802
811
  _queryParams["downstream_websocket_url"] = downstreamWebsocketUrl;
803
812
  }
804
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
805
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PhonicEnvironment.Default)
813
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
814
+ Authorization: yield this._getAuthorizationHeader(),
815
+ "X-Sip-Address": sipAddress,
816
+ "X-Sip-Auth-Username": sipAuthUsername != null ? sipAuthUsername : undefined,
817
+ "X-Sip-Auth-Password": sipAuthPassword != null ? sipAuthPassword : undefined,
818
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
819
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
820
+ url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
806
821
  .base, "conversations/sip/outbound_call"),
807
822
  method: "POST",
808
- headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
809
- Authorization: yield this._getAuthorizationHeader(),
810
- "X-Sip-Address": sipAddress,
811
- "X-Sip-Auth-Username": sipAuthUsername != null ? sipAuthUsername : undefined,
812
- "X-Sip-Auth-Password": sipAuthPassword != null ? sipAuthPassword : undefined,
813
- }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
823
+ headers: _headers,
814
824
  contentType: "application/json",
815
825
  queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
816
826
  requestType: "json",
@@ -866,8 +876,7 @@ class Conversations {
866
876
  if (downstream_websocket_url != null) {
867
877
  _queryParams["downstream_websocket_url"] = downstream_websocket_url;
868
878
  }
869
- let _headers = Object.assign({}, headers);
870
- _headers["Authorization"] = yield this._getAuthorizationHeader();
879
+ let _headers = (0, headers_js_1.mergeHeaders)((0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), headers);
871
880
  const socket = new core.ReconnectingWebSocket({
872
881
  url: core.url.join((_a = (yield core.Supplier.get(this._options["baseUrl"]))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options["environment"]))) !== null && _b !== void 0 ? _b : environments.PhonicEnvironment.Default)
873
882
  .production, "/v1/sts/ws"),
@@ -9,12 +9,16 @@ export interface Conversation {
9
9
  agent?: Conversation.Agent;
10
10
  /** The organization/workspace name. */
11
11
  workspace: string;
12
+ /** The project associated with the conversation. */
13
+ project: Conversation.Project;
12
14
  /** External ID for conversation tracking. */
13
15
  external_id?: string;
14
16
  /** The STS model used. */
15
17
  model: string;
16
18
  /** Welcome message played at start. */
17
19
  welcome_message?: string;
20
+ /** Template variables used in the conversation. */
21
+ template_variables: Record<string, string>;
18
22
  /** Audio input format. */
19
23
  input_format: string;
20
24
  /** Audio output format. */
@@ -31,8 +35,6 @@ export interface Conversation {
31
35
  started_at: string;
32
36
  /** When the conversation ended. */
33
37
  ended_at?: string;
34
- /** System prompt used for the conversation. */
35
- system_prompt: string;
36
38
  /** Array of conversation items (turns). */
37
39
  items: Phonic.ConversationItem[];
38
40
  /** Results from conversation evaluations and extractions. */
@@ -47,5 +49,16 @@ export declare namespace Conversation {
47
49
  id: string;
48
50
  /** The name of the agent. */
49
51
  name: string;
52
+ /** Whether the agent has been deleted. */
53
+ is_deleted: boolean;
54
+ }
55
+ /**
56
+ * The project associated with the conversation.
57
+ */
58
+ interface Project {
59
+ /** The ID of the project. */
60
+ id: string;
61
+ /** The name of the project. */
62
+ name: string;
50
63
  }
51
64
  }
@@ -18,6 +18,10 @@ export interface ConversationItem {
18
18
  voice_id?: string;
19
19
  /** Audio speed used (assistant only). */
20
20
  audio_speed?: number;
21
+ /** System prompt used for this assistant turn. */
22
+ system_prompt?: string;
23
+ /** Tool calls made by the assistant. */
24
+ tool_calls?: ConversationItem.ToolCalls.Item[];
21
25
  }
22
26
  export declare namespace ConversationItem {
23
27
  /**
@@ -28,4 +32,44 @@ export declare namespace ConversationItem {
28
32
  readonly User: "user";
29
33
  readonly Assistant: "assistant";
30
34
  };
35
+ type ToolCalls = ToolCalls.Item[];
36
+ namespace ToolCalls {
37
+ interface Item {
38
+ /** The tool call ID. */
39
+ id: string;
40
+ tool: Item.Tool;
41
+ /** HTTP method for webhook tool calls. */
42
+ endpoint_method?: string;
43
+ /** URL for webhook tool calls. */
44
+ endpoint_url?: string;
45
+ /** Headers for webhook tool calls. */
46
+ endpoint_headers?: Record<string, string | undefined>;
47
+ /** Timeout in milliseconds for webhook tool calls. */
48
+ endpoint_timeout_ms?: number;
49
+ /** When the webhook endpoint was called (null on error). */
50
+ endpoint_called_at?: string;
51
+ /** Query parameters for webhook tool calls (null on error or when no params). */
52
+ query_params?: Record<string, unknown>;
53
+ /** HTTP response status code for webhook tool calls (null on error). */
54
+ response_status_code?: number;
55
+ /** Timeout in milliseconds for websocket tool calls. */
56
+ tool_call_output_timeout_ms?: number;
57
+ /** The request body sent to the tool. */
58
+ request_body?: Record<string, unknown>;
59
+ /** The response body received from the tool. */
60
+ response_body?: Record<string, unknown>;
61
+ /** Whether the tool call timed out. */
62
+ timed_out?: boolean;
63
+ /** Error message if the tool call failed. */
64
+ error_message?: string;
65
+ }
66
+ namespace Item {
67
+ interface Tool {
68
+ /** The tool ID. */
69
+ id: string;
70
+ /** The tool name. */
71
+ name: string;
72
+ }
73
+ }
74
+ }
31
75
  }
@@ -7,7 +7,7 @@ export declare namespace ReconnectingWebSocket {
7
7
  url: string;
8
8
  protocols?: string | string[];
9
9
  options?: ReconnectingWebSocket.Options;
10
- headers?: Record<string, string>;
10
+ headers?: Record<string, any>;
11
11
  queryParameters?: Record<string, string | string[] | object | object[] | null | undefined>;
12
12
  }
13
13
  type Options = {
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.4";
1
+ export declare const SDK_VERSION = "0.30.6";
@@ -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.4";
4
+ exports.SDK_VERSION = "0.30.6";
@@ -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.4",
18
- "User-Agent": "phonic/0.30.4",
17
+ "X-Fern-SDK-Version": "0.30.6",
18
+ "User-Agent": "phonic/0.30.6",
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) });