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.
- package/README.md +394 -0
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +9 -4
- package/dist/cjs/api/resources/agents/client/Client.d.ts +12 -0
- package/dist/cjs/api/resources/agents/client/Client.js +12 -0
- package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +6 -0
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +13 -0
- package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +4 -0
- package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +4 -0
- package/dist/cjs/api/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/index.js +3 -1
- package/dist/cjs/api/resources/tts/client/Client.d.ts +23 -0
- package/dist/cjs/api/resources/tts/client/Client.js +115 -0
- package/dist/cjs/api/resources/tts/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/tts/client/index.js +17 -0
- package/dist/cjs/api/resources/tts/client/requests/StreamTtsRequest.d.ts +28 -0
- package/dist/cjs/api/resources/tts/client/requests/StreamTtsRequest.js +14 -0
- package/dist/cjs/api/resources/tts/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/tts/client/requests/index.js +5 -0
- package/dist/cjs/api/resources/tts/exports.d.ts +2 -0
- package/dist/cjs/api/resources/tts/exports.js +21 -0
- package/dist/cjs/api/resources/tts/index.d.ts +1 -0
- package/dist/cjs/api/resources/tts/index.js +17 -0
- package/dist/cjs/api/types/Agent.d.ts +9 -0
- package/dist/cjs/api/types/ConfigOptions.d.ts +11 -5
- package/dist/cjs/api/types/Conversation.d.ts +9 -0
- package/dist/cjs/api/types/CreateAgentRequest.d.ts +9 -0
- package/dist/cjs/api/types/InlineWebSocketTool.d.ts +30 -0
- package/dist/cjs/api/types/InlineWebSocketTool.js +12 -0
- package/dist/cjs/api/types/OpenAiFunction.d.ts +10 -0
- package/dist/cjs/api/types/OpenAiFunction.js +3 -0
- package/dist/cjs/api/types/OpenAiFunctionParameters.d.ts +4 -0
- package/dist/cjs/api/types/OpenAiFunctionParameters.js +3 -0
- package/dist/cjs/api/types/OpenAiTool.d.ts +8 -0
- package/dist/cjs/api/types/OpenAiTool.js +3 -0
- package/dist/cjs/api/types/OutboundCallConfig.d.ts +9 -0
- package/dist/cjs/api/types/ToolDefinition.d.ts +2 -0
- package/dist/cjs/api/types/ToolDefinition.js +3 -0
- package/dist/cjs/api/types/ToolName.d.ts +4 -0
- package/dist/cjs/api/types/ToolName.js +3 -0
- package/dist/cjs/api/types/index.d.ts +6 -0
- package/dist/cjs/api/types/index.js +6 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +5 -0
- package/dist/esm/api/resources/agents/client/Client.d.mts +12 -0
- package/dist/esm/api/resources/agents/client/Client.mjs +12 -0
- package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +6 -0
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +13 -0
- package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +4 -0
- package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +4 -0
- package/dist/esm/api/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/index.mjs +2 -0
- package/dist/esm/api/resources/tts/client/Client.d.mts +23 -0
- package/dist/esm/api/resources/tts/client/Client.mjs +78 -0
- package/dist/esm/api/resources/tts/client/index.d.mts +1 -0
- package/dist/esm/api/resources/tts/client/index.mjs +1 -0
- package/dist/esm/api/resources/tts/client/requests/StreamTtsRequest.d.mts +28 -0
- package/dist/esm/api/resources/tts/client/requests/StreamTtsRequest.mjs +11 -0
- package/dist/esm/api/resources/tts/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/tts/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/tts/exports.d.mts +2 -0
- package/dist/esm/api/resources/tts/exports.mjs +3 -0
- package/dist/esm/api/resources/tts/index.d.mts +1 -0
- package/dist/esm/api/resources/tts/index.mjs +1 -0
- package/dist/esm/api/types/Agent.d.mts +9 -0
- package/dist/esm/api/types/ConfigOptions.d.mts +11 -5
- package/dist/esm/api/types/Conversation.d.mts +9 -0
- package/dist/esm/api/types/CreateAgentRequest.d.mts +9 -0
- package/dist/esm/api/types/InlineWebSocketTool.d.mts +30 -0
- package/dist/esm/api/types/InlineWebSocketTool.mjs +9 -0
- package/dist/esm/api/types/OpenAiFunction.d.mts +10 -0
- package/dist/esm/api/types/OpenAiFunction.mjs +2 -0
- package/dist/esm/api/types/OpenAiFunctionParameters.d.mts +4 -0
- package/dist/esm/api/types/OpenAiFunctionParameters.mjs +2 -0
- package/dist/esm/api/types/OpenAiTool.d.mts +8 -0
- package/dist/esm/api/types/OpenAiTool.mjs +2 -0
- package/dist/esm/api/types/OutboundCallConfig.d.mts +9 -0
- package/dist/esm/api/types/ToolDefinition.d.mts +2 -0
- package/dist/esm/api/types/ToolDefinition.mjs +2 -0
- package/dist/esm/api/types/ToolName.d.mts +4 -0
- package/dist/esm/api/types/ToolName.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +6 -0
- package/dist/esm/api/types/index.mjs +6 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +19 -8
- package/reference.md +82 -0
|
@@ -126,6 +126,10 @@ export class AgentsClient {
|
|
|
126
126
|
* multilingual_mode: "request",
|
|
127
127
|
* push_to_talk: false,
|
|
128
128
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
129
|
+
* pronunciation_dictionary: [{
|
|
130
|
+
* word: "Phuket",
|
|
131
|
+
* pronunciation: "Poo-ket"
|
|
132
|
+
* }],
|
|
129
133
|
* min_words_to_interrupt: 1,
|
|
130
134
|
* configuration_endpoint: {
|
|
131
135
|
* url: "https://api.example.com/config",
|
|
@@ -225,6 +229,10 @@ export class AgentsClient {
|
|
|
225
229
|
* multilingual_mode: "request",
|
|
226
230
|
* push_to_talk: false,
|
|
227
231
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
232
|
+
* pronunciation_dictionary: [{
|
|
233
|
+
* word: "Phuket",
|
|
234
|
+
* pronunciation: "Poo-ket"
|
|
235
|
+
* }],
|
|
228
236
|
* min_words_to_interrupt: 1,
|
|
229
237
|
* configuration_endpoint: {
|
|
230
238
|
* url: "https://api.example.com/config",
|
|
@@ -440,6 +448,10 @@ export class AgentsClient {
|
|
|
440
448
|
* multilingual_mode: "request",
|
|
441
449
|
* push_to_talk: false,
|
|
442
450
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
451
|
+
* pronunciation_dictionary: [{
|
|
452
|
+
* word: "Phuket",
|
|
453
|
+
* pronunciation: "Poo-ket"
|
|
454
|
+
* }],
|
|
443
455
|
* min_words_to_interrupt: 1,
|
|
444
456
|
* configuration_endpoint: {
|
|
445
457
|
* url: "https://api.example.com/config",
|
|
@@ -29,6 +29,10 @@ import type * as Phonic from "../../../../index.mjs";
|
|
|
29
29
|
* multilingual_mode: "request",
|
|
30
30
|
* push_to_talk: false,
|
|
31
31
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
32
|
+
* pronunciation_dictionary: [{
|
|
33
|
+
* word: "Phuket",
|
|
34
|
+
* pronunciation: "Poo-ket"
|
|
35
|
+
* }],
|
|
32
36
|
* min_words_to_interrupt: 1,
|
|
33
37
|
* configuration_endpoint: {
|
|
34
38
|
* url: "https://api.example.com/config",
|
|
@@ -94,6 +98,8 @@ export interface AgentsCreateRequest {
|
|
|
94
98
|
push_to_talk?: boolean;
|
|
95
99
|
/** These words, or short phrases, will be more accurately recognized by the agent. */
|
|
96
100
|
boosted_keywords?: string[];
|
|
101
|
+
/** Array of `{ word, pronunciation }` entries. Words must be unique. */
|
|
102
|
+
pronunciation_dictionary?: Phonic.CreateAgentRequest.PronunciationDictionary.Item[];
|
|
97
103
|
/** Minimum number of words required to interrupt the assistant. */
|
|
98
104
|
min_words_to_interrupt?: number;
|
|
99
105
|
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
|
|
@@ -29,6 +29,10 @@ import type * as Phonic from "../../../../index.mjs";
|
|
|
29
29
|
* multilingual_mode: "request",
|
|
30
30
|
* push_to_talk: false,
|
|
31
31
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
32
|
+
* pronunciation_dictionary: [{
|
|
33
|
+
* word: "Phuket",
|
|
34
|
+
* pronunciation: "Poo-ket"
|
|
35
|
+
* }],
|
|
32
36
|
* min_words_to_interrupt: 1,
|
|
33
37
|
* configuration_endpoint: {
|
|
34
38
|
* url: "https://api.example.com/config",
|
|
@@ -94,6 +98,8 @@ export interface UpdateAgentRequest {
|
|
|
94
98
|
push_to_talk?: boolean;
|
|
95
99
|
/** These words, or short phrases, will be more accurately recognized by the agent. */
|
|
96
100
|
boosted_keywords?: string[];
|
|
101
|
+
/** Array of `{ word, pronunciation }` entries. Words must be unique. */
|
|
102
|
+
pronunciation_dictionary?: UpdateAgentRequest.PronunciationDictionary.Item[];
|
|
97
103
|
/** Minimum number of words required to interrupt the assistant. */
|
|
98
104
|
min_words_to_interrupt?: number;
|
|
99
105
|
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
|
|
@@ -151,6 +157,13 @@ export declare namespace UpdateAgentRequest {
|
|
|
151
157
|
readonly Request: "request";
|
|
152
158
|
};
|
|
153
159
|
type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
|
|
160
|
+
type PronunciationDictionary = PronunciationDictionary.Item[];
|
|
161
|
+
namespace PronunciationDictionary {
|
|
162
|
+
interface Item {
|
|
163
|
+
word: string;
|
|
164
|
+
pronunciation: string;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
154
167
|
/**
|
|
155
168
|
* When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options.
|
|
156
169
|
*/
|
|
@@ -29,6 +29,10 @@ import type * as Phonic from "../../../../index.mjs";
|
|
|
29
29
|
* multilingual_mode: "request",
|
|
30
30
|
* push_to_talk: false,
|
|
31
31
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
32
|
+
* pronunciation_dictionary: [{
|
|
33
|
+
* word: "Phuket",
|
|
34
|
+
* pronunciation: "Poo-ket"
|
|
35
|
+
* }],
|
|
32
36
|
* min_words_to_interrupt: 1,
|
|
33
37
|
* configuration_endpoint: {
|
|
34
38
|
* url: "https://api.example.com/config",
|
|
@@ -21,6 +21,10 @@ import type * as Phonic from "../../../../index.mjs";
|
|
|
21
21
|
* multilingual_mode: "request",
|
|
22
22
|
* push_to_talk: false,
|
|
23
23
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
24
|
+
* pronunciation_dictionary: [{
|
|
25
|
+
* word: "Phuket",
|
|
26
|
+
* pronunciation: "Poo-ket"
|
|
27
|
+
* }],
|
|
24
28
|
* min_words_to_interrupt: 1,
|
|
25
29
|
* tools: ["keypad_input"]
|
|
26
30
|
* },
|
|
@@ -18,6 +18,8 @@ export * from "./projects/types/index.mjs";
|
|
|
18
18
|
export * from "./tools/client/requests/index.mjs";
|
|
19
19
|
export * as tools from "./tools/index.mjs";
|
|
20
20
|
export * from "./tools/types/index.mjs";
|
|
21
|
+
export * from "./tts/client/requests/index.mjs";
|
|
22
|
+
export * as tts from "./tts/index.mjs";
|
|
21
23
|
export * from "./voices/client/requests/index.mjs";
|
|
22
24
|
export * as voices from "./voices/index.mjs";
|
|
23
25
|
export * from "./voices/types/index.mjs";
|
|
@@ -18,6 +18,8 @@ export * from "./projects/types/index.mjs";
|
|
|
18
18
|
export * from "./tools/client/requests/index.mjs";
|
|
19
19
|
export * as tools from "./tools/index.mjs";
|
|
20
20
|
export * from "./tools/types/index.mjs";
|
|
21
|
+
export * from "./tts/client/requests/index.mjs";
|
|
22
|
+
export * as tts from "./tts/index.mjs";
|
|
21
23
|
export * from "./voices/client/requests/index.mjs";
|
|
22
24
|
export * as voices from "./voices/index.mjs";
|
|
23
25
|
export * from "./voices/types/index.mjs";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
|
+
import * as core from "../../../../core/index.mjs";
|
|
4
|
+
import * as Phonic from "../../../index.mjs";
|
|
5
|
+
export declare namespace TtsClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class TtsClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<TtsClient.Options>;
|
|
12
|
+
constructor(options?: TtsClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Streams generated speech audio for the provided text.
|
|
15
|
+
*
|
|
16
|
+
* @throws {@link Phonic.BadRequestError}
|
|
17
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
18
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
19
|
+
* @throws {@link Phonic.InternalServerError}
|
|
20
|
+
*/
|
|
21
|
+
stream(request: Phonic.StreamTtsRequest, requestOptions?: TtsClient.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
|
|
22
|
+
private __stream;
|
|
23
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
13
|
+
import * as core from "../../../../core/index.mjs";
|
|
14
|
+
import * as environments from "../../../../environments.mjs";
|
|
15
|
+
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
17
|
+
import * as Phonic from "../../../index.mjs";
|
|
18
|
+
export class TtsClient {
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Streams generated speech audio for the provided text.
|
|
24
|
+
*
|
|
25
|
+
* @throws {@link Phonic.BadRequestError}
|
|
26
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
27
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
28
|
+
* @throws {@link Phonic.InternalServerError}
|
|
29
|
+
*/
|
|
30
|
+
stream(request, requestOptions) {
|
|
31
|
+
return core.HttpResponsePromise.fromPromise(this.__stream(request, requestOptions));
|
|
32
|
+
}
|
|
33
|
+
__stream(request, requestOptions) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
36
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
37
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
38
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
39
|
+
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)
|
|
40
|
+
.base, "tts/stream"),
|
|
41
|
+
method: "POST",
|
|
42
|
+
headers: _headers,
|
|
43
|
+
contentType: "application/json",
|
|
44
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
45
|
+
requestType: "json",
|
|
46
|
+
body: request,
|
|
47
|
+
responseType: "binary-response",
|
|
48
|
+
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,
|
|
49
|
+
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,
|
|
50
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
51
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
52
|
+
logging: this._options.logging,
|
|
53
|
+
});
|
|
54
|
+
if (_response.ok) {
|
|
55
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
56
|
+
}
|
|
57
|
+
if (_response.error.reason === "status-code") {
|
|
58
|
+
switch (_response.error.statusCode) {
|
|
59
|
+
case 400:
|
|
60
|
+
throw new Phonic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
61
|
+
case 401:
|
|
62
|
+
throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
63
|
+
case 403:
|
|
64
|
+
throw new Phonic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
65
|
+
case 500:
|
|
66
|
+
throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
67
|
+
default:
|
|
68
|
+
throw new errors.PhonicError({
|
|
69
|
+
statusCode: _response.error.statusCode,
|
|
70
|
+
body: _response.error.body,
|
|
71
|
+
rawResponse: _response.rawResponse,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/tts/stream");
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -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,11 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var StreamTtsRequest;
|
|
3
|
+
(function (StreamTtsRequest) {
|
|
4
|
+
/** The audio format to stream. */
|
|
5
|
+
StreamTtsRequest.OutputFormat = {
|
|
6
|
+
Pcm44100: "pcm_44100",
|
|
7
|
+
Pcm16000: "pcm_16000",
|
|
8
|
+
Pcm8000: "pcm_8000",
|
|
9
|
+
Mulaw8000: "mulaw_8000",
|
|
10
|
+
};
|
|
11
|
+
})(StreamTtsRequest || (StreamTtsRequest = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StreamTtsRequest } from "./StreamTtsRequest.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StreamTtsRequest } from "./StreamTtsRequest.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -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.mjs";
|
|
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
|
-
/**
|
|
58
|
-
|
|
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
|
|
93
|
-
namespace
|
|
94
|
-
|
|
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.mjs";
|
|
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,9 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var InlineWebSocketTool;
|
|
3
|
+
(function (InlineWebSocketTool) {
|
|
4
|
+
/** Whether the assistant waits for the tool output before continuing. */
|
|
5
|
+
InlineWebSocketTool.ExecutionMode = {
|
|
6
|
+
Sync: "sync",
|
|
7
|
+
Async: "async",
|
|
8
|
+
};
|
|
9
|
+
})(InlineWebSocketTool || (InlineWebSocketTool = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as Phonic from "../index.mjs";
|
|
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
|
+
}
|
|
@@ -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"
|
|
@@ -29,10 +29,14 @@ export * from "./ErrorPayload.mjs";
|
|
|
29
29
|
export * from "./ExtractionField.mjs";
|
|
30
30
|
export * from "./ExtractionSchema.mjs";
|
|
31
31
|
export * from "./GenerateReplyPayload.mjs";
|
|
32
|
+
export * from "./InlineWebSocketTool.mjs";
|
|
32
33
|
export * from "./InputCancelledPayload.mjs";
|
|
33
34
|
export * from "./InputTextPayload.mjs";
|
|
34
35
|
export * from "./LanguageCode.mjs";
|
|
35
36
|
export * from "./MutePayload.mjs";
|
|
37
|
+
export * from "./OpenAiFunction.mjs";
|
|
38
|
+
export * from "./OpenAiFunctionParameters.mjs";
|
|
39
|
+
export * from "./OpenAiTool.mjs";
|
|
36
40
|
export * from "./OutboundCallConfig.mjs";
|
|
37
41
|
export * from "./OutboundCallInitiatedResponse.mjs";
|
|
38
42
|
export * from "./OutboundDryRunResponse.mjs";
|
|
@@ -52,6 +56,8 @@ export * from "./ToolCallInterruptedPayload.mjs";
|
|
|
52
56
|
export * from "./ToolCallOutputPayload.mjs";
|
|
53
57
|
export * from "./ToolCallOutputProcessedPayload.mjs";
|
|
54
58
|
export * from "./ToolCallPayload.mjs";
|
|
59
|
+
export * from "./ToolDefinition.mjs";
|
|
60
|
+
export * from "./ToolName.mjs";
|
|
55
61
|
export * from "./ToolParameter.mjs";
|
|
56
62
|
export * from "./UnmutePayload.mjs";
|
|
57
63
|
export * from "./UpdateSystemPromptPayload.mjs";
|
|
@@ -29,10 +29,14 @@ export * from "./ErrorPayload.mjs";
|
|
|
29
29
|
export * from "./ExtractionField.mjs";
|
|
30
30
|
export * from "./ExtractionSchema.mjs";
|
|
31
31
|
export * from "./GenerateReplyPayload.mjs";
|
|
32
|
+
export * from "./InlineWebSocketTool.mjs";
|
|
32
33
|
export * from "./InputCancelledPayload.mjs";
|
|
33
34
|
export * from "./InputTextPayload.mjs";
|
|
34
35
|
export * from "./LanguageCode.mjs";
|
|
35
36
|
export * from "./MutePayload.mjs";
|
|
37
|
+
export * from "./OpenAiFunction.mjs";
|
|
38
|
+
export * from "./OpenAiFunctionParameters.mjs";
|
|
39
|
+
export * from "./OpenAiTool.mjs";
|
|
36
40
|
export * from "./OutboundCallConfig.mjs";
|
|
37
41
|
export * from "./OutboundCallInitiatedResponse.mjs";
|
|
38
42
|
export * from "./OutboundDryRunResponse.mjs";
|
|
@@ -52,6 +56,8 @@ export * from "./ToolCallInterruptedPayload.mjs";
|
|
|
52
56
|
export * from "./ToolCallOutputPayload.mjs";
|
|
53
57
|
export * from "./ToolCallOutputProcessedPayload.mjs";
|
|
54
58
|
export * from "./ToolCallPayload.mjs";
|
|
59
|
+
export * from "./ToolDefinition.mjs";
|
|
60
|
+
export * from "./ToolName.mjs";
|
|
55
61
|
export * from "./ToolParameter.mjs";
|
|
56
62
|
export * from "./UnmutePayload.mjs";
|
|
57
63
|
export * from "./UpdateSystemPromptPayload.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.31.
|
|
1
|
+
export declare const SDK_VERSION = "0.31.16";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.31.
|
|
1
|
+
export const SDK_VERSION = "0.31.16";
|