phonic 0.31.15 → 0.31.16

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 (91) hide show
  1. package/README.md +394 -0
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/Client.d.ts +3 -0
  4. package/dist/cjs/Client.js +9 -4
  5. package/dist/cjs/api/resources/agents/client/Client.d.ts +12 -0
  6. package/dist/cjs/api/resources/agents/client/Client.js +12 -0
  7. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +6 -0
  8. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +13 -0
  9. package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +4 -0
  10. package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +4 -0
  11. package/dist/cjs/api/resources/index.d.ts +2 -0
  12. package/dist/cjs/api/resources/index.js +3 -1
  13. package/dist/cjs/api/resources/tts/client/Client.d.ts +23 -0
  14. package/dist/cjs/api/resources/tts/client/Client.js +115 -0
  15. package/dist/cjs/api/resources/tts/client/index.d.ts +1 -0
  16. package/dist/cjs/api/resources/tts/client/index.js +17 -0
  17. package/dist/cjs/api/resources/tts/client/requests/StreamTtsRequest.d.ts +28 -0
  18. package/dist/cjs/api/resources/tts/client/requests/StreamTtsRequest.js +14 -0
  19. package/dist/cjs/api/resources/tts/client/requests/index.d.ts +1 -0
  20. package/dist/cjs/api/resources/tts/client/requests/index.js +5 -0
  21. package/dist/cjs/api/resources/tts/exports.d.ts +2 -0
  22. package/dist/cjs/api/resources/tts/exports.js +21 -0
  23. package/dist/cjs/api/resources/tts/index.d.ts +1 -0
  24. package/dist/cjs/api/resources/tts/index.js +17 -0
  25. package/dist/cjs/api/types/Agent.d.ts +9 -0
  26. package/dist/cjs/api/types/ConfigOptions.d.ts +11 -5
  27. package/dist/cjs/api/types/Conversation.d.ts +9 -0
  28. package/dist/cjs/api/types/CreateAgentRequest.d.ts +9 -0
  29. package/dist/cjs/api/types/InlineWebSocketTool.d.ts +30 -0
  30. package/dist/cjs/api/types/InlineWebSocketTool.js +12 -0
  31. package/dist/cjs/api/types/OpenAiFunction.d.ts +10 -0
  32. package/dist/cjs/api/types/OpenAiFunction.js +3 -0
  33. package/dist/cjs/api/types/OpenAiFunctionParameters.d.ts +4 -0
  34. package/dist/cjs/api/types/OpenAiFunctionParameters.js +3 -0
  35. package/dist/cjs/api/types/OpenAiTool.d.ts +8 -0
  36. package/dist/cjs/api/types/OpenAiTool.js +3 -0
  37. package/dist/cjs/api/types/OutboundCallConfig.d.ts +9 -0
  38. package/dist/cjs/api/types/ToolDefinition.d.ts +2 -0
  39. package/dist/cjs/api/types/ToolDefinition.js +3 -0
  40. package/dist/cjs/api/types/ToolName.d.ts +4 -0
  41. package/dist/cjs/api/types/ToolName.js +3 -0
  42. package/dist/cjs/api/types/index.d.ts +6 -0
  43. package/dist/cjs/api/types/index.js +6 -0
  44. package/dist/cjs/version.d.ts +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/esm/BaseClient.mjs +2 -2
  47. package/dist/esm/Client.d.mts +3 -0
  48. package/dist/esm/Client.mjs +5 -0
  49. package/dist/esm/api/resources/agents/client/Client.d.mts +12 -0
  50. package/dist/esm/api/resources/agents/client/Client.mjs +12 -0
  51. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +6 -0
  52. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +13 -0
  53. package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +4 -0
  54. package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +4 -0
  55. package/dist/esm/api/resources/index.d.mts +2 -0
  56. package/dist/esm/api/resources/index.mjs +2 -0
  57. package/dist/esm/api/resources/tts/client/Client.d.mts +23 -0
  58. package/dist/esm/api/resources/tts/client/Client.mjs +78 -0
  59. package/dist/esm/api/resources/tts/client/index.d.mts +1 -0
  60. package/dist/esm/api/resources/tts/client/index.mjs +1 -0
  61. package/dist/esm/api/resources/tts/client/requests/StreamTtsRequest.d.mts +28 -0
  62. package/dist/esm/api/resources/tts/client/requests/StreamTtsRequest.mjs +11 -0
  63. package/dist/esm/api/resources/tts/client/requests/index.d.mts +1 -0
  64. package/dist/esm/api/resources/tts/client/requests/index.mjs +1 -0
  65. package/dist/esm/api/resources/tts/exports.d.mts +2 -0
  66. package/dist/esm/api/resources/tts/exports.mjs +3 -0
  67. package/dist/esm/api/resources/tts/index.d.mts +1 -0
  68. package/dist/esm/api/resources/tts/index.mjs +1 -0
  69. package/dist/esm/api/types/Agent.d.mts +9 -0
  70. package/dist/esm/api/types/ConfigOptions.d.mts +11 -5
  71. package/dist/esm/api/types/Conversation.d.mts +9 -0
  72. package/dist/esm/api/types/CreateAgentRequest.d.mts +9 -0
  73. package/dist/esm/api/types/InlineWebSocketTool.d.mts +30 -0
  74. package/dist/esm/api/types/InlineWebSocketTool.mjs +9 -0
  75. package/dist/esm/api/types/OpenAiFunction.d.mts +10 -0
  76. package/dist/esm/api/types/OpenAiFunction.mjs +2 -0
  77. package/dist/esm/api/types/OpenAiFunctionParameters.d.mts +4 -0
  78. package/dist/esm/api/types/OpenAiFunctionParameters.mjs +2 -0
  79. package/dist/esm/api/types/OpenAiTool.d.mts +8 -0
  80. package/dist/esm/api/types/OpenAiTool.mjs +2 -0
  81. package/dist/esm/api/types/OutboundCallConfig.d.mts +9 -0
  82. package/dist/esm/api/types/ToolDefinition.d.mts +2 -0
  83. package/dist/esm/api/types/ToolDefinition.mjs +2 -0
  84. package/dist/esm/api/types/ToolName.d.mts +4 -0
  85. package/dist/esm/api/types/ToolName.mjs +2 -0
  86. package/dist/esm/api/types/index.d.mts +6 -0
  87. package/dist/esm/api/types/index.mjs +6 -0
  88. package/dist/esm/version.d.mts +1 -1
  89. package/dist/esm/version.mjs +1 -1
  90. package/package.json +19 -8
  91. package/reference.md +82 -0
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.TtsClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
48
+ const headers_js_1 = require("../../../../core/headers.js");
49
+ const core = __importStar(require("../../../../core/index.js"));
50
+ const environments = __importStar(require("../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
52
+ const errors = __importStar(require("../../../../errors/index.js"));
53
+ const Phonic = __importStar(require("../../../index.js"));
54
+ class TtsClient {
55
+ constructor(options = {}) {
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
+ }
58
+ /**
59
+ * Streams generated speech audio for the provided text.
60
+ *
61
+ * @throws {@link Phonic.BadRequestError}
62
+ * @throws {@link Phonic.UnauthorizedError}
63
+ * @throws {@link Phonic.ForbiddenError}
64
+ * @throws {@link Phonic.InternalServerError}
65
+ */
66
+ stream(request, requestOptions) {
67
+ return core.HttpResponsePromise.fromPromise(this.__stream(request, requestOptions));
68
+ }
69
+ __stream(request, requestOptions) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
72
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
73
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
74
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
75
+ 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)
76
+ .base, "tts/stream"),
77
+ method: "POST",
78
+ headers: _headers,
79
+ contentType: "application/json",
80
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
81
+ requestType: "json",
82
+ body: request,
83
+ responseType: "binary-response",
84
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
85
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
86
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
87
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
88
+ logging: this._options.logging,
89
+ });
90
+ if (_response.ok) {
91
+ return { data: _response.body, rawResponse: _response.rawResponse };
92
+ }
93
+ if (_response.error.reason === "status-code") {
94
+ switch (_response.error.statusCode) {
95
+ case 400:
96
+ throw new Phonic.BadRequestError(_response.error.body, _response.rawResponse);
97
+ case 401:
98
+ throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
99
+ case 403:
100
+ throw new Phonic.ForbiddenError(_response.error.body, _response.rawResponse);
101
+ case 500:
102
+ throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
103
+ default:
104
+ throw new errors.PhonicError({
105
+ statusCode: _response.error.statusCode,
106
+ body: _response.error.body,
107
+ rawResponse: _response.rawResponse,
108
+ });
109
+ }
110
+ }
111
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/tts/stream");
112
+ });
113
+ }
114
+ }
115
+ exports.TtsClient = TtsClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * text: "x"
5
+ * }
6
+ */
7
+ export interface StreamTtsRequest {
8
+ /** The text to convert to speech. */
9
+ text: string;
10
+ /** The TTS model to use. */
11
+ model?: "merritt";
12
+ /** The speech speed. */
13
+ speed?: number;
14
+ /** The voice ID to use. */
15
+ voice_id?: string;
16
+ /** The audio format to stream. */
17
+ output_format?: StreamTtsRequest.OutputFormat;
18
+ }
19
+ export declare namespace StreamTtsRequest {
20
+ /** The audio format to stream. */
21
+ const OutputFormat: {
22
+ readonly Pcm44100: "pcm_44100";
23
+ readonly Pcm16000: "pcm_16000";
24
+ readonly Pcm8000: "pcm_8000";
25
+ readonly Mulaw8000: "mulaw_8000";
26
+ };
27
+ type OutputFormat = (typeof OutputFormat)[keyof typeof OutputFormat];
28
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.StreamTtsRequest = void 0;
5
+ var StreamTtsRequest;
6
+ (function (StreamTtsRequest) {
7
+ /** The audio format to stream. */
8
+ StreamTtsRequest.OutputFormat = {
9
+ Pcm44100: "pcm_44100",
10
+ Pcm16000: "pcm_16000",
11
+ Pcm8000: "pcm_8000",
12
+ Mulaw8000: "mulaw_8000",
13
+ };
14
+ })(StreamTtsRequest || (exports.StreamTtsRequest = StreamTtsRequest = {}));
@@ -0,0 +1 @@
1
+ export { StreamTtsRequest } from "./StreamTtsRequest.js";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StreamTtsRequest = void 0;
4
+ var StreamTtsRequest_js_1 = require("./StreamTtsRequest.js");
5
+ Object.defineProperty(exports, "StreamTtsRequest", { enumerable: true, get: function () { return StreamTtsRequest_js_1.StreamTtsRequest; } });
@@ -0,0 +1,2 @@
1
+ export { TtsClient } from "./client/Client.js";
2
+ export * from "./client/index.js";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.TtsClient = void 0;
19
+ var Client_js_1 = require("./client/Client.js");
20
+ Object.defineProperty(exports, "TtsClient", { enumerable: true, get: function () { return Client_js_1.TtsClient; } });
21
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -54,6 +54,8 @@ export interface Agent {
54
54
  push_to_talk: boolean;
55
55
  /** These words, or short phrases, will be more accurately recognized by the agent. */
56
56
  boosted_keywords: string[];
57
+ /** Array of `{ word, pronunciation }` entries. Words must be unique. */
58
+ pronunciation_dictionary: Agent.PronunciationDictionary.Item[];
57
59
  /** Minimum number of words required to interrupt the assistant. */
58
60
  min_words_to_interrupt: number;
59
61
  /** When not `null`, the agent will call this endpoint to get configuration options. */
@@ -112,6 +114,13 @@ export declare namespace Agent {
112
114
  readonly Request: "request";
113
115
  };
114
116
  type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
117
+ type PronunciationDictionary = PronunciationDictionary.Item[];
118
+ namespace PronunciationDictionary {
119
+ interface Item {
120
+ word: string;
121
+ pronunciation: string;
122
+ }
123
+ }
115
124
  /**
116
125
  * When not `null`, the agent will call this endpoint to get configuration options.
117
126
  */
@@ -1,3 +1,4 @@
1
+ import type * as Phonic from "../index.js";
1
2
  /**
2
3
  * Configuration fields for the initial `config` message.
3
4
  */
@@ -54,8 +55,10 @@ export interface ConfigOptions {
54
55
  push_to_talk?: boolean | undefined;
55
56
  /** Keywords to boost in speech recognition */
56
57
  boosted_keywords?: string[] | undefined;
57
- /** Names of tools available to the assistant. */
58
- tools?: ConfigOptions.Tools.Item[] | undefined;
58
+ /** Array of `{ word, pronunciation }` entries. Words must be unique. */
59
+ pronunciation_dictionary?: ConfigOptions.PronunciationDictionary.Item[] | undefined;
60
+ /** Tools available to the assistant. Use a string to reference a pre-defined tool by name, or define an inline WebSocket tool for this conversation. */
61
+ tools?: Phonic.ToolDefinition[] | undefined;
59
62
  /** Template variables for system prompt and welcome message */
60
63
  template_variables?: Record<string, string> | undefined;
61
64
  }
@@ -89,8 +92,11 @@ export declare namespace ConfigOptions {
89
92
  readonly Request: "request";
90
93
  };
91
94
  type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
92
- type Tools = Tools.Item[];
93
- namespace Tools {
94
- type Item = string | Record<string, unknown>;
95
+ type PronunciationDictionary = PronunciationDictionary.Item[];
96
+ namespace PronunciationDictionary {
97
+ interface Item {
98
+ word: string;
99
+ pronunciation: string;
100
+ }
95
101
  }
96
102
  }
@@ -46,6 +46,8 @@ export interface Conversation {
46
46
  ended_by: Conversation.EndedBy | null;
47
47
  /** These words, or short phrases, are more accurately recognized by the model. */
48
48
  boosted_keywords: string[] | null;
49
+ /** Array of `{ word, pronunciation }` entries. Words must be unique. */
50
+ pronunciation_dictionary: Conversation.PronunciationDictionary.Item[];
49
51
  /** Minimum number of words required to interrupt the assistant. */
50
52
  min_words_to_interrupt: number;
51
53
  /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
@@ -129,6 +131,13 @@ export declare namespace Conversation {
129
131
  readonly Error: "error";
130
132
  };
131
133
  type EndedBy = (typeof EndedBy)[keyof typeof EndedBy];
134
+ type PronunciationDictionary = PronunciationDictionary.Item[];
135
+ namespace PronunciationDictionary {
136
+ interface Item {
137
+ word: string;
138
+ pronunciation: string;
139
+ }
140
+ }
132
141
  /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). */
133
142
  const MultilingualMode: {
134
143
  readonly Auto: "auto";
@@ -52,6 +52,8 @@ export interface CreateAgentRequest {
52
52
  push_to_talk?: boolean | undefined;
53
53
  /** These words, or short phrases, will be more accurately recognized by the agent. */
54
54
  boosted_keywords?: string[] | undefined;
55
+ /** Array of `{ word, pronunciation }` entries. Words must be unique. */
56
+ pronunciation_dictionary?: CreateAgentRequest.PronunciationDictionary.Item[] | undefined;
55
57
  /** Minimum number of words required to interrupt the assistant. */
56
58
  min_words_to_interrupt?: number | undefined;
57
59
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
@@ -109,6 +111,13 @@ export declare namespace CreateAgentRequest {
109
111
  readonly Request: "request";
110
112
  };
111
113
  type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
114
+ type PronunciationDictionary = PronunciationDictionary.Item[];
115
+ namespace PronunciationDictionary {
116
+ interface Item {
117
+ word: string;
118
+ pronunciation: string;
119
+ }
120
+ }
112
121
  /**
113
122
  * When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options.
114
123
  */
@@ -0,0 +1,30 @@
1
+ import type * as Phonic from "../index.js";
2
+ /**
3
+ * Inline WebSocket tool definition for this conversation. Inline tools are not persisted to your workspace; they are executed by your connected WebSocket application when Phonic sends a `tool_call` message.
4
+ */
5
+ export interface InlineWebSocketTool {
6
+ type: "custom_websocket";
7
+ tool_schema: Phonic.OpenAiTool;
8
+ /** Whether the assistant waits for the tool output before continuing. */
9
+ execution_mode?: InlineWebSocketTool.ExecutionMode | undefined;
10
+ /** Timeout in milliseconds for the client to send a `tool_call_output` message. */
11
+ tool_call_output_timeout_ms?: number | undefined;
12
+ /** When true, forces the assistant to speak before executing the tool. */
13
+ require_speech_before_tool_call?: boolean | undefined;
14
+ /** When true, waits for the assistant's speech to finish before sending the tool call. */
15
+ wait_for_speech_before_tool_call?: boolean | undefined;
16
+ /** When true, prevents the assistant from speaking after executing the tool. */
17
+ forbid_speech_after_tool_call?: boolean | undefined;
18
+ /** When true, allows the assistant to call another tool after this tool. */
19
+ allow_tool_chaining?: boolean | undefined;
20
+ /** For async tools, when true, the assistant waits for the response and speaks when it arrives. */
21
+ wait_for_response?: boolean | undefined;
22
+ }
23
+ export declare namespace InlineWebSocketTool {
24
+ /** Whether the assistant waits for the tool output before continuing. */
25
+ const ExecutionMode: {
26
+ readonly Sync: "sync";
27
+ readonly Async: "async";
28
+ };
29
+ type ExecutionMode = (typeof ExecutionMode)[keyof typeof ExecutionMode];
30
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.InlineWebSocketTool = void 0;
5
+ var InlineWebSocketTool;
6
+ (function (InlineWebSocketTool) {
7
+ /** Whether the assistant waits for the tool output before continuing. */
8
+ InlineWebSocketTool.ExecutionMode = {
9
+ Sync: "sync",
10
+ Async: "async",
11
+ };
12
+ })(InlineWebSocketTool || (exports.InlineWebSocketTool = InlineWebSocketTool = {}));
@@ -0,0 +1,10 @@
1
+ import type * as Phonic from "../index.js";
2
+ export interface OpenAiFunction {
3
+ /** Function name the assistant will use in `tool_call.tool_name`. */
4
+ name: string;
5
+ /** Description of what the tool does and when to call it. */
6
+ description: string;
7
+ parameters: Phonic.OpenAiFunctionParameters;
8
+ /** Inline tools require strict function calling. */
9
+ strict: true;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ /**
2
+ * JSON Schema object describing the tool parameters. This follows OpenAI's function tool `parameters` field.
3
+ */
4
+ export type OpenAiFunctionParameters = Record<string, unknown>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import type * as Phonic from "../index.js";
2
+ /**
3
+ * OpenAI-compatible function tool schema.
4
+ */
5
+ export interface OpenAiTool {
6
+ type: "function";
7
+ function: Phonic.OpenAiFunction;
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -35,6 +35,8 @@ export interface OutboundCallConfig {
35
35
  push_to_talk?: boolean | undefined;
36
36
  /** These words, or short phrases, will be more accurately recognized by the agent. */
37
37
  boosted_keywords?: string[] | undefined;
38
+ /** Array of `{ word, pronunciation }` entries. Words must be unique. */
39
+ pronunciation_dictionary?: OutboundCallConfig.PronunciationDictionary.Item[] | undefined;
38
40
  /** Minimum number of words required to interrupt the assistant. */
39
41
  min_words_to_interrupt?: number | undefined;
40
42
  /** Array of built-in or custom tool names to use. */
@@ -47,6 +49,13 @@ export declare namespace OutboundCallConfig {
47
49
  readonly Request: "request";
48
50
  };
49
51
  type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
52
+ type PronunciationDictionary = PronunciationDictionary.Item[];
53
+ namespace PronunciationDictionary {
54
+ interface Item {
55
+ word: string;
56
+ pronunciation: string;
57
+ }
58
+ }
50
59
  type Tools = Tools.Item[];
51
60
  namespace Tools {
52
61
  type Item = "keypad_input" | "natural_conversation_ending"
@@ -0,0 +1,2 @@
1
+ import type * as Phonic from "../index.js";
2
+ export type ToolDefinition = Phonic.ToolName | Phonic.InlineWebSocketTool;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Name of a pre-defined tool or built-in tool available to the assistant.
3
+ */
4
+ export type ToolName = string;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -29,10 +29,14 @@ export * from "./ErrorPayload.js";
29
29
  export * from "./ExtractionField.js";
30
30
  export * from "./ExtractionSchema.js";
31
31
  export * from "./GenerateReplyPayload.js";
32
+ export * from "./InlineWebSocketTool.js";
32
33
  export * from "./InputCancelledPayload.js";
33
34
  export * from "./InputTextPayload.js";
34
35
  export * from "./LanguageCode.js";
35
36
  export * from "./MutePayload.js";
37
+ export * from "./OpenAiFunction.js";
38
+ export * from "./OpenAiFunctionParameters.js";
39
+ export * from "./OpenAiTool.js";
36
40
  export * from "./OutboundCallConfig.js";
37
41
  export * from "./OutboundCallInitiatedResponse.js";
38
42
  export * from "./OutboundDryRunResponse.js";
@@ -52,6 +56,8 @@ export * from "./ToolCallInterruptedPayload.js";
52
56
  export * from "./ToolCallOutputPayload.js";
53
57
  export * from "./ToolCallOutputProcessedPayload.js";
54
58
  export * from "./ToolCallPayload.js";
59
+ export * from "./ToolDefinition.js";
60
+ export * from "./ToolName.js";
55
61
  export * from "./ToolParameter.js";
56
62
  export * from "./UnmutePayload.js";
57
63
  export * from "./UpdateSystemPromptPayload.js";
@@ -45,10 +45,14 @@ __exportStar(require("./ErrorPayload.js"), exports);
45
45
  __exportStar(require("./ExtractionField.js"), exports);
46
46
  __exportStar(require("./ExtractionSchema.js"), exports);
47
47
  __exportStar(require("./GenerateReplyPayload.js"), exports);
48
+ __exportStar(require("./InlineWebSocketTool.js"), exports);
48
49
  __exportStar(require("./InputCancelledPayload.js"), exports);
49
50
  __exportStar(require("./InputTextPayload.js"), exports);
50
51
  __exportStar(require("./LanguageCode.js"), exports);
51
52
  __exportStar(require("./MutePayload.js"), exports);
53
+ __exportStar(require("./OpenAiFunction.js"), exports);
54
+ __exportStar(require("./OpenAiFunctionParameters.js"), exports);
55
+ __exportStar(require("./OpenAiTool.js"), exports);
52
56
  __exportStar(require("./OutboundCallConfig.js"), exports);
53
57
  __exportStar(require("./OutboundCallInitiatedResponse.js"), exports);
54
58
  __exportStar(require("./OutboundDryRunResponse.js"), exports);
@@ -68,6 +72,8 @@ __exportStar(require("./ToolCallInterruptedPayload.js"), exports);
68
72
  __exportStar(require("./ToolCallOutputPayload.js"), exports);
69
73
  __exportStar(require("./ToolCallOutputProcessedPayload.js"), exports);
70
74
  __exportStar(require("./ToolCallPayload.js"), exports);
75
+ __exportStar(require("./ToolDefinition.js"), exports);
76
+ __exportStar(require("./ToolName.js"), exports);
71
77
  __exportStar(require("./ToolParameter.js"), exports);
72
78
  __exportStar(require("./UnmutePayload.js"), exports);
73
79
  __exportStar(require("./UpdateSystemPromptPayload.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.31.13";
1
+ export declare const SDK_VERSION = "0.31.16";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.31.13";
4
+ exports.SDK_VERSION = "0.31.16";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "phonic",
9
- "X-Fern-SDK-Version": "0.31.13",
10
- "User-Agent": "phonic/0.31.13",
9
+ "X-Fern-SDK-Version": "0.31.16",
10
+ "User-Agent": "phonic/0.31.16",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -5,6 +5,7 @@ import { ConversationsClient } from "./api/resources/conversations/client/Client
5
5
  import { ExtractionSchemasClient } from "./api/resources/extractionSchemas/client/Client.mjs";
6
6
  import { ProjectsClient } from "./api/resources/projects/client/Client.mjs";
7
7
  import { ToolsClient } from "./api/resources/tools/client/Client.mjs";
8
+ import { TtsClient } from "./api/resources/tts/client/Client.mjs";
8
9
  import { VoicesClient } from "./api/resources/voices/client/Client.mjs";
9
10
  import { WorkspaceClient } from "./api/resources/workspace/client/Client.mjs";
10
11
  import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
@@ -28,6 +29,7 @@ export declare class PhonicClient {
28
29
  protected _agents: AgentsClient | undefined;
29
30
  protected _tools: ToolsClient | undefined;
30
31
  protected _extractionSchemas: ExtractionSchemasClient | undefined;
32
+ protected _tts: TtsClient | undefined;
31
33
  protected _voices: VoicesClient | undefined;
32
34
  protected _conversations: ConversationsClient | undefined;
33
35
  protected _conversationItems: ConversationItemsClient | undefined;
@@ -38,6 +40,7 @@ export declare class PhonicClient {
38
40
  get agents(): AgentsClient;
39
41
  get tools(): ToolsClient;
40
42
  get extractionSchemas(): ExtractionSchemasClient;
43
+ get tts(): TtsClient;
41
44
  get voices(): VoicesClient;
42
45
  get conversations(): ConversationsClient;
43
46
  get conversationItems(): ConversationItemsClient;
@@ -15,6 +15,7 @@ import { ConversationsClient } from "./api/resources/conversations/client/Client
15
15
  import { ExtractionSchemasClient } from "./api/resources/extractionSchemas/client/Client.mjs";
16
16
  import { ProjectsClient } from "./api/resources/projects/client/Client.mjs";
17
17
  import { ToolsClient } from "./api/resources/tools/client/Client.mjs";
18
+ import { TtsClient } from "./api/resources/tts/client/Client.mjs";
18
19
  import { VoicesClient } from "./api/resources/voices/client/Client.mjs";
19
20
  import { WorkspaceClient } from "./api/resources/workspace/client/Client.mjs";
20
21
  import { normalizeClientOptionsWithAuth } from "./BaseClient.mjs";
@@ -36,6 +37,10 @@ export class PhonicClient {
36
37
  var _a;
37
38
  return ((_a = this._extractionSchemas) !== null && _a !== void 0 ? _a : (this._extractionSchemas = new ExtractionSchemasClient(this._options)));
38
39
  }
40
+ get tts() {
41
+ var _a;
42
+ return ((_a = this._tts) !== null && _a !== void 0 ? _a : (this._tts = new TtsClient(this._options)));
43
+ }
39
44
  get voices() {
40
45
  var _a;
41
46
  return ((_a = this._voices) !== null && _a !== void 0 ? _a : (this._voices = new VoicesClient(this._options)));
@@ -64,6 +64,10 @@ export declare class AgentsClient {
64
64
  * multilingual_mode: "request",
65
65
  * push_to_talk: false,
66
66
  * boosted_keywords: ["Load ID", "dispatch"],
67
+ * pronunciation_dictionary: [{
68
+ * word: "Phuket",
69
+ * pronunciation: "Poo-ket"
70
+ * }],
67
71
  * min_words_to_interrupt: 1,
68
72
  * configuration_endpoint: {
69
73
  * url: "https://api.example.com/config",
@@ -114,6 +118,10 @@ export declare class AgentsClient {
114
118
  * multilingual_mode: "request",
115
119
  * push_to_talk: false,
116
120
  * boosted_keywords: ["Load ID", "dispatch"],
121
+ * pronunciation_dictionary: [{
122
+ * word: "Phuket",
123
+ * pronunciation: "Poo-ket"
124
+ * }],
117
125
  * min_words_to_interrupt: 1,
118
126
  * configuration_endpoint: {
119
127
  * url: "https://api.example.com/config",
@@ -200,6 +208,10 @@ export declare class AgentsClient {
200
208
  * multilingual_mode: "request",
201
209
  * push_to_talk: false,
202
210
  * boosted_keywords: ["Load ID", "dispatch"],
211
+ * pronunciation_dictionary: [{
212
+ * word: "Phuket",
213
+ * pronunciation: "Poo-ket"
214
+ * }],
203
215
  * min_words_to_interrupt: 1,
204
216
  * configuration_endpoint: {
205
217
  * url: "https://api.example.com/config",