hume 0.8.1-beta8 → 0.8.1
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/.mock/definition/empathic-voice/__package__.yml +0 -14
- package/.mock/definition/empathic-voice/chatGroups.yml +5 -0
- package/.mock/definition/empathic-voice/configs.yml +3 -0
- package/.mock/definition/empathic-voice/prompts.yml +3 -0
- package/.mock/definition/empathic-voice/tools.yml +3 -0
- package/api/resources/empathicVoice/resources/chat/client/Client.js +4 -5
- package/api/resources/empathicVoice/resources/chat/client/Socket.d.ts +2 -1
- package/api/resources/empathicVoice/resources/chat/client/Socket.js +28 -3
- package/api/resources/empathicVoice/resources/chatGroups/client/Client.js +4 -1
- package/api/resources/empathicVoice/resources/chatGroups/client/requests/ChatGroupsListChatGroupsRequest.d.ts +4 -0
- package/api/resources/empathicVoice/resources/configs/client/Client.js +4 -1
- package/api/resources/empathicVoice/resources/configs/client/requests/ConfigsListConfigsRequest.d.ts +4 -0
- package/api/resources/empathicVoice/resources/prompts/client/Client.js +4 -1
- package/api/resources/empathicVoice/resources/prompts/client/requests/PromptsListPromptsRequest.d.ts +4 -0
- package/api/resources/empathicVoice/resources/tools/client/Client.js +4 -1
- package/api/resources/empathicVoice/resources/tools/client/requests/ToolsListToolsRequest.d.ts +4 -0
- package/api/resources/empathicVoice/types/index.d.ts +0 -2
- package/api/resources/empathicVoice/types/index.js +0 -2
- package/api/resources/index.d.ts +1 -1
- package/api/resources/index.js +2 -2
- package/core/websocket/ws.js +6 -0
- package/dist/api/resources/empathicVoice/resources/chat/client/Client.js +4 -5
- package/dist/api/resources/empathicVoice/resources/chat/client/Socket.d.ts +2 -1
- package/dist/api/resources/empathicVoice/resources/chat/client/Socket.js +28 -3
- package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.js +4 -1
- package/dist/api/resources/empathicVoice/resources/chatGroups/client/requests/ChatGroupsListChatGroupsRequest.d.ts +4 -0
- package/dist/api/resources/empathicVoice/resources/configs/client/Client.js +4 -1
- package/dist/api/resources/empathicVoice/resources/configs/client/requests/ConfigsListConfigsRequest.d.ts +4 -0
- package/dist/api/resources/empathicVoice/resources/prompts/client/Client.js +4 -1
- package/dist/api/resources/empathicVoice/resources/prompts/client/requests/PromptsListPromptsRequest.d.ts +4 -0
- package/dist/api/resources/empathicVoice/resources/tools/client/Client.js +4 -1
- package/dist/api/resources/empathicVoice/resources/tools/client/requests/ToolsListToolsRequest.d.ts +4 -0
- package/dist/api/resources/empathicVoice/types/index.d.ts +0 -2
- package/dist/api/resources/empathicVoice/types/index.js +0 -2
- package/dist/api/resources/index.d.ts +1 -1
- package/dist/api/resources/index.js +2 -2
- package/dist/core/websocket/ws.js +6 -0
- package/dist/serialization/resources/empathicVoice/types/index.d.ts +0 -2
- package/dist/serialization/resources/empathicVoice/types/index.js +0 -2
- package/dist/serialization/resources/index.d.ts +1 -1
- package/dist/serialization/resources/index.js +2 -2
- package/package.json +1 -1
- package/reference.md +444 -444
- package/serialization/resources/empathicVoice/types/index.d.ts +0 -2
- package/serialization/resources/empathicVoice/types/index.js +0 -2
- package/serialization/resources/index.d.ts +1 -1
- package/serialization/resources/index.js +2 -2
- package/api/resources/empathicVoice/types/ReturnPrivacySettings.d.ts +0 -8
- package/api/resources/empathicVoice/types/ReturnPrivacySettings.js +0 -5
- package/api/resources/empathicVoice/types/ReturnPurgeStats.d.ts +0 -12
- package/api/resources/empathicVoice/types/ReturnPurgeStats.js +0 -5
- package/dist/api/resources/empathicVoice/types/ReturnPrivacySettings.d.ts +0 -8
- package/dist/api/resources/empathicVoice/types/ReturnPrivacySettings.js +0 -5
- package/dist/api/resources/empathicVoice/types/ReturnPurgeStats.d.ts +0 -12
- package/dist/api/resources/empathicVoice/types/ReturnPurgeStats.js +0 -5
- package/dist/serialization/resources/empathicVoice/types/ReturnPrivacySettings.d.ts +0 -14
- package/dist/serialization/resources/empathicVoice/types/ReturnPrivacySettings.js +0 -35
- package/dist/serialization/resources/empathicVoice/types/ReturnPurgeStats.d.ts +0 -18
- package/dist/serialization/resources/empathicVoice/types/ReturnPurgeStats.js +0 -39
- package/serialization/resources/empathicVoice/types/ReturnPrivacySettings.d.ts +0 -14
- package/serialization/resources/empathicVoice/types/ReturnPrivacySettings.js +0 -35
- package/serialization/resources/empathicVoice/types/ReturnPurgeStats.d.ts +0 -18
- package/serialization/resources/empathicVoice/types/ReturnPurgeStats.js +0 -39
|
@@ -423,11 +423,6 @@ types:
|
|
|
423
423
|
docs: >-
|
|
424
424
|
String with the name of the voice to use. Maximum length of 75
|
|
425
425
|
characters. Will be converted to all-uppercase.
|
|
426
|
-
ReturnPrivacySettings:
|
|
427
|
-
properties:
|
|
428
|
-
id: optional<string>
|
|
429
|
-
do_not_retain_data: optional<boolean>
|
|
430
|
-
do_not_use_for_training: optional<boolean>
|
|
431
426
|
PostedCustomVoiceName:
|
|
432
427
|
docs: A custom voice name change to be posted to the server
|
|
433
428
|
properties:
|
|
@@ -794,15 +789,6 @@ types:
|
|
|
794
789
|
List of chat_events returned for the specified page number and page
|
|
795
790
|
size.
|
|
796
791
|
type: list<ReturnChatEvent>
|
|
797
|
-
ReturnPurgeStats:
|
|
798
|
-
properties:
|
|
799
|
-
id: optional<string>
|
|
800
|
-
num_chats: optional<integer>
|
|
801
|
-
num_chat_events: optional<integer>
|
|
802
|
-
num_configs: optional<integer>
|
|
803
|
-
num_prompts: optional<integer>
|
|
804
|
-
num_tools: optional<integer>
|
|
805
|
-
num_voices: optional<integer>
|
|
806
792
|
AssistantInput:
|
|
807
793
|
docs: When provided, the input is spoken by EVI.
|
|
808
794
|
properties:
|
|
@@ -24,6 +24,11 @@ service:
|
|
|
24
24
|
Boolean to indicate if the results should be paginated in
|
|
25
25
|
chronological order or reverse-chronological order. Defaults to
|
|
26
26
|
true.
|
|
27
|
+
config_id:
|
|
28
|
+
type: optional<string>
|
|
29
|
+
docs: >-
|
|
30
|
+
Filter chatgroups to only include chats that used this config in
|
|
31
|
+
their most recent chat.
|
|
27
32
|
response:
|
|
28
33
|
docs: Success
|
|
29
34
|
type: root.ReturnPagedChatGroups
|
|
@@ -21,6 +21,9 @@ service:
|
|
|
21
21
|
restrict_to_most_recent:
|
|
22
22
|
type: optional<boolean>
|
|
23
23
|
docs: Only include the most recent version of each config in the list.
|
|
24
|
+
name:
|
|
25
|
+
type: optional<string>
|
|
26
|
+
docs: Filter to only include configs with this name.
|
|
24
27
|
response:
|
|
25
28
|
docs: Success
|
|
26
29
|
type: root.ReturnPagedConfigs
|
|
@@ -21,6 +21,9 @@ service:
|
|
|
21
21
|
restrict_to_most_recent:
|
|
22
22
|
type: optional<boolean>
|
|
23
23
|
docs: Only include the most recent version of each prompt in the list.
|
|
24
|
+
name:
|
|
25
|
+
type: optional<string>
|
|
26
|
+
docs: Filter to only include prompts with this name.
|
|
24
27
|
response:
|
|
25
28
|
docs: Success
|
|
26
29
|
type: root.ReturnPagedPrompts
|
|
@@ -21,6 +21,9 @@ service:
|
|
|
21
21
|
restrict_to_most_recent:
|
|
22
22
|
type: optional<boolean>
|
|
23
23
|
docs: Only include the most recent version of each tool in the list.
|
|
24
|
+
name:
|
|
25
|
+
type: optional<string>
|
|
26
|
+
docs: Filter to only include tools with this name.
|
|
24
27
|
response:
|
|
25
28
|
docs: Success
|
|
26
29
|
type: root.ReturnPagedUserDefinedTools
|
|
@@ -35,13 +35,13 @@ class Chat {
|
|
|
35
35
|
this._options = _options;
|
|
36
36
|
}
|
|
37
37
|
connect(args = {}) {
|
|
38
|
-
var _a;
|
|
38
|
+
var _a, _b;
|
|
39
39
|
const queryParams = {};
|
|
40
40
|
if (this._options.accessToken != null) {
|
|
41
|
-
queryParams["accessToken"] =
|
|
41
|
+
queryParams["accessToken"] = this._options.accessToken;
|
|
42
42
|
}
|
|
43
43
|
else if (this._options.apiKey != null) {
|
|
44
|
-
queryParams["apiKey"] =
|
|
44
|
+
queryParams["apiKey"] = this._options.apiKey;
|
|
45
45
|
}
|
|
46
46
|
if (args.configId != null) {
|
|
47
47
|
queryParams["config_id"] = args.configId;
|
|
@@ -58,9 +58,8 @@ class Chat {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
const socket = new core.ReconnectingWebSocket(`wss://api.hume.ai/v0/evi/chat?${qs_1.default.stringify(queryParams)}`, [], {
|
|
61
|
-
startClosed: true,
|
|
62
61
|
debug: (_a = args.debug) !== null && _a !== void 0 ? _a : false,
|
|
63
|
-
maxRetries: args.reconnectAttempts,
|
|
62
|
+
maxRetries: (_b = args.reconnectAttempts) !== null && _b !== void 0 ? _b : 30,
|
|
64
63
|
});
|
|
65
64
|
return new Socket_1.ChatSocket({
|
|
66
65
|
socket,
|
|
@@ -67,13 +67,14 @@ export declare class ChatSocket {
|
|
|
67
67
|
/**
|
|
68
68
|
* @name connect
|
|
69
69
|
* @description
|
|
70
|
-
* Connect to the
|
|
70
|
+
* Connect to the core.ReconnectingWebSocket.
|
|
71
71
|
*/
|
|
72
72
|
connect(): ChatSocket;
|
|
73
73
|
/**
|
|
74
74
|
* Closes the underlying socket.
|
|
75
75
|
*/
|
|
76
76
|
close(): void;
|
|
77
|
+
tillSocketOpen(): Promise<core.ReconnectingWebSocket>;
|
|
77
78
|
private assertSocketIsOpen;
|
|
78
79
|
private sendJson;
|
|
79
80
|
private handleOpen;
|
|
@@ -22,8 +22,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
25
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
35
|
exports.ChatSocket = void 0;
|
|
36
|
+
const core = __importStar(require("../../../../../../core"));
|
|
27
37
|
const errors = __importStar(require("../../../../../../errors"));
|
|
28
38
|
const serializers = __importStar(require("../../../../../../serialization/index"));
|
|
29
39
|
class ChatSocket {
|
|
@@ -55,7 +65,7 @@ class ChatSocket {
|
|
|
55
65
|
};
|
|
56
66
|
this.handleError = (event) => {
|
|
57
67
|
var _a, _b, _c;
|
|
58
|
-
const message = (_a = event.message) !== null && _a !== void 0 ? _a : '
|
|
68
|
+
const message = (_a = event.message) !== null && _a !== void 0 ? _a : 'core.ReconnectingWebSocket error';
|
|
59
69
|
(_c = (_b = this.eventHandlers).error) === null || _c === void 0 ? void 0 : _c.call(_b, new Error(message));
|
|
60
70
|
};
|
|
61
71
|
this.socket = socket;
|
|
@@ -142,7 +152,7 @@ class ChatSocket {
|
|
|
142
152
|
/**
|
|
143
153
|
* @name connect
|
|
144
154
|
* @description
|
|
145
|
-
* Connect to the
|
|
155
|
+
* Connect to the core.ReconnectingWebSocket.
|
|
146
156
|
*/
|
|
147
157
|
connect() {
|
|
148
158
|
this.socket.reconnect();
|
|
@@ -163,11 +173,26 @@ class ChatSocket {
|
|
|
163
173
|
this.socket.removeEventListener('close', this.handleClose);
|
|
164
174
|
this.socket.removeEventListener('error', this.handleError);
|
|
165
175
|
}
|
|
176
|
+
tillSocketOpen() {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
if (this.socket.readyState === core.ReconnectingWebSocket.OPEN) {
|
|
179
|
+
return this.socket;
|
|
180
|
+
}
|
|
181
|
+
return new Promise((resolve, reject) => {
|
|
182
|
+
this.socket.addEventListener("open", () => {
|
|
183
|
+
resolve(this.socket);
|
|
184
|
+
});
|
|
185
|
+
this.socket.addEventListener("error", (event) => {
|
|
186
|
+
reject(event);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
}
|
|
166
191
|
assertSocketIsOpen() {
|
|
167
192
|
if (!this.socket) {
|
|
168
193
|
throw new errors.HumeError({ message: 'Socket is not connected.' });
|
|
169
194
|
}
|
|
170
|
-
if (this.socket.readyState !==
|
|
195
|
+
if (this.socket.readyState !== core.ReconnectingWebSocket.OPEN) {
|
|
171
196
|
throw new errors.HumeError({ message: 'Socket is not open.' });
|
|
172
197
|
}
|
|
173
198
|
}
|
|
@@ -58,7 +58,7 @@ class ChatGroups {
|
|
|
58
58
|
listChatGroups(request = {}, requestOptions) {
|
|
59
59
|
var _a, _b;
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const { pageNumber, pageSize, ascendingOrder } = request;
|
|
61
|
+
const { pageNumber, pageSize, ascendingOrder, configId } = request;
|
|
62
62
|
const _queryParams = {};
|
|
63
63
|
if (pageNumber != null) {
|
|
64
64
|
_queryParams["page_number"] = pageNumber.toString();
|
|
@@ -69,6 +69,9 @@ class ChatGroups {
|
|
|
69
69
|
if (ascendingOrder != null) {
|
|
70
70
|
_queryParams["ascending_order"] = ascendingOrder.toString();
|
|
71
71
|
}
|
|
72
|
+
if (configId != null) {
|
|
73
|
+
_queryParams["config_id"] = configId;
|
|
74
|
+
}
|
|
72
75
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
73
76
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, "v0/evi/chat_groups"),
|
|
74
77
|
method: "GET",
|
|
@@ -18,4 +18,8 @@ export interface ChatGroupsListChatGroupsRequest {
|
|
|
18
18
|
* Boolean to indicate if the results should be paginated in chronological order or reverse-chronological order. Defaults to true.
|
|
19
19
|
*/
|
|
20
20
|
ascendingOrder?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Filter chatgroups to only include chats that used this config in their most recent chat.
|
|
23
|
+
*/
|
|
24
|
+
configId?: string;
|
|
21
25
|
}
|
|
@@ -58,7 +58,7 @@ class Configs {
|
|
|
58
58
|
listConfigs(request = {}, requestOptions) {
|
|
59
59
|
var _a, _b;
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const { pageNumber, pageSize, restrictToMostRecent } = request;
|
|
61
|
+
const { pageNumber, pageSize, restrictToMostRecent, name } = request;
|
|
62
62
|
const _queryParams = {};
|
|
63
63
|
if (pageNumber != null) {
|
|
64
64
|
_queryParams["page_number"] = pageNumber.toString();
|
|
@@ -69,6 +69,9 @@ class Configs {
|
|
|
69
69
|
if (restrictToMostRecent != null) {
|
|
70
70
|
_queryParams["restrict_to_most_recent"] = restrictToMostRecent.toString();
|
|
71
71
|
}
|
|
72
|
+
if (name != null) {
|
|
73
|
+
_queryParams["name"] = name;
|
|
74
|
+
}
|
|
72
75
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
73
76
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, "v0/evi/configs"),
|
|
74
77
|
method: "GET",
|
|
@@ -58,7 +58,7 @@ class Prompts {
|
|
|
58
58
|
listPrompts(request = {}, requestOptions) {
|
|
59
59
|
var _a, _b;
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const { pageNumber, pageSize, restrictToMostRecent } = request;
|
|
61
|
+
const { pageNumber, pageSize, restrictToMostRecent, name } = request;
|
|
62
62
|
const _queryParams = {};
|
|
63
63
|
if (pageNumber != null) {
|
|
64
64
|
_queryParams["page_number"] = pageNumber.toString();
|
|
@@ -69,6 +69,9 @@ class Prompts {
|
|
|
69
69
|
if (restrictToMostRecent != null) {
|
|
70
70
|
_queryParams["restrict_to_most_recent"] = restrictToMostRecent.toString();
|
|
71
71
|
}
|
|
72
|
+
if (name != null) {
|
|
73
|
+
_queryParams["name"] = name;
|
|
74
|
+
}
|
|
72
75
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
73
76
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, "v0/evi/prompts"),
|
|
74
77
|
method: "GET",
|
|
@@ -61,7 +61,7 @@ class Tools {
|
|
|
61
61
|
listTools(request = {}, requestOptions) {
|
|
62
62
|
var _a, _b;
|
|
63
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const { pageNumber, pageSize, restrictToMostRecent } = request;
|
|
64
|
+
const { pageNumber, pageSize, restrictToMostRecent, name } = request;
|
|
65
65
|
const _queryParams = {};
|
|
66
66
|
if (pageNumber != null) {
|
|
67
67
|
_queryParams["page_number"] = pageNumber.toString();
|
|
@@ -72,6 +72,9 @@ class Tools {
|
|
|
72
72
|
if (restrictToMostRecent != null) {
|
|
73
73
|
_queryParams["restrict_to_most_recent"] = restrictToMostRecent.toString();
|
|
74
74
|
}
|
|
75
|
+
if (name != null) {
|
|
76
|
+
_queryParams["name"] = name;
|
|
77
|
+
}
|
|
75
78
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
76
79
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, "v0/evi/tools"),
|
|
77
80
|
method: "GET",
|
|
@@ -25,7 +25,6 @@ export * from "./ReturnLanguageModel";
|
|
|
25
25
|
export * from "./ReturnTimeoutSpec";
|
|
26
26
|
export * from "./ReturnTimeoutSpecs";
|
|
27
27
|
export * from "./ReturnVoice";
|
|
28
|
-
export * from "./ReturnPrivacySettings";
|
|
29
28
|
export * from "./PostedCustomVoiceName";
|
|
30
29
|
export * from "./ReturnPagedUserDefinedTools";
|
|
31
30
|
export * from "./ReturnPagedPrompts";
|
|
@@ -42,7 +41,6 @@ export * from "./ReturnChatGroup";
|
|
|
42
41
|
export * from "./ReturnPagedChatGroups";
|
|
43
42
|
export * from "./ReturnChatGroupPagedChats";
|
|
44
43
|
export * from "./ReturnChatGroupPagedEvents";
|
|
45
|
-
export * from "./ReturnPurgeStats";
|
|
46
44
|
export * from "./AssistantInput";
|
|
47
45
|
export * from "./AudioConfiguration";
|
|
48
46
|
export * from "./AudioInput";
|
|
@@ -41,7 +41,6 @@ __exportStar(require("./ReturnLanguageModel"), exports);
|
|
|
41
41
|
__exportStar(require("./ReturnTimeoutSpec"), exports);
|
|
42
42
|
__exportStar(require("./ReturnTimeoutSpecs"), exports);
|
|
43
43
|
__exportStar(require("./ReturnVoice"), exports);
|
|
44
|
-
__exportStar(require("./ReturnPrivacySettings"), exports);
|
|
45
44
|
__exportStar(require("./PostedCustomVoiceName"), exports);
|
|
46
45
|
__exportStar(require("./ReturnPagedUserDefinedTools"), exports);
|
|
47
46
|
__exportStar(require("./ReturnPagedPrompts"), exports);
|
|
@@ -58,7 +57,6 @@ __exportStar(require("./ReturnChatGroup"), exports);
|
|
|
58
57
|
__exportStar(require("./ReturnPagedChatGroups"), exports);
|
|
59
58
|
__exportStar(require("./ReturnChatGroupPagedChats"), exports);
|
|
60
59
|
__exportStar(require("./ReturnChatGroupPagedEvents"), exports);
|
|
61
|
-
__exportStar(require("./ReturnPurgeStats"), exports);
|
|
62
60
|
__exportStar(require("./AssistantInput"), exports);
|
|
63
61
|
__exportStar(require("./AudioConfiguration"), exports);
|
|
64
62
|
__exportStar(require("./AudioInput"), exports);
|
package/api/resources/index.d.ts
CHANGED
package/api/resources/index.js
CHANGED
|
@@ -23,6 +23,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
exports.expressionMeasurement = __importStar(require("./expressionMeasurement"));
|
|
26
|
+
exports.expressionMeasurement = exports.empathicVoice = void 0;
|
|
28
27
|
exports.empathicVoice = __importStar(require("./empathicVoice"));
|
|
28
|
+
exports.expressionMeasurement = __importStar(require("./expressionMeasurement"));
|
package/core/websocket/ws.js
CHANGED
|
@@ -24,12 +24,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ReconnectingWebSocket = void 0;
|
|
27
|
+
const runtime_1 = require("../runtime");
|
|
27
28
|
const Events = __importStar(require("./events"));
|
|
29
|
+
const ws_1 = require("ws");
|
|
28
30
|
const getGlobalWebSocket = () => {
|
|
29
31
|
if (typeof WebSocket !== 'undefined') {
|
|
30
32
|
// @ts-ignore
|
|
31
33
|
return WebSocket;
|
|
32
34
|
}
|
|
35
|
+
else if (runtime_1.RUNTIME.type === "node") {
|
|
36
|
+
return ws_1.WebSocket;
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
33
39
|
};
|
|
34
40
|
/**
|
|
35
41
|
* Returns true if given argument looks like a WebSocket class
|
|
@@ -35,13 +35,13 @@ class Chat {
|
|
|
35
35
|
this._options = _options;
|
|
36
36
|
}
|
|
37
37
|
connect(args = {}) {
|
|
38
|
-
var _a;
|
|
38
|
+
var _a, _b;
|
|
39
39
|
const queryParams = {};
|
|
40
40
|
if (this._options.accessToken != null) {
|
|
41
|
-
queryParams["accessToken"] =
|
|
41
|
+
queryParams["accessToken"] = this._options.accessToken;
|
|
42
42
|
}
|
|
43
43
|
else if (this._options.apiKey != null) {
|
|
44
|
-
queryParams["apiKey"] =
|
|
44
|
+
queryParams["apiKey"] = this._options.apiKey;
|
|
45
45
|
}
|
|
46
46
|
if (args.configId != null) {
|
|
47
47
|
queryParams["config_id"] = args.configId;
|
|
@@ -58,9 +58,8 @@ class Chat {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
const socket = new core.ReconnectingWebSocket(`wss://api.hume.ai/v0/evi/chat?${qs_1.default.stringify(queryParams)}`, [], {
|
|
61
|
-
startClosed: true,
|
|
62
61
|
debug: (_a = args.debug) !== null && _a !== void 0 ? _a : false,
|
|
63
|
-
maxRetries: args.reconnectAttempts,
|
|
62
|
+
maxRetries: (_b = args.reconnectAttempts) !== null && _b !== void 0 ? _b : 30,
|
|
64
63
|
});
|
|
65
64
|
return new Socket_1.ChatSocket({
|
|
66
65
|
socket,
|
|
@@ -67,13 +67,14 @@ export declare class ChatSocket {
|
|
|
67
67
|
/**
|
|
68
68
|
* @name connect
|
|
69
69
|
* @description
|
|
70
|
-
* Connect to the
|
|
70
|
+
* Connect to the core.ReconnectingWebSocket.
|
|
71
71
|
*/
|
|
72
72
|
connect(): ChatSocket;
|
|
73
73
|
/**
|
|
74
74
|
* Closes the underlying socket.
|
|
75
75
|
*/
|
|
76
76
|
close(): void;
|
|
77
|
+
tillSocketOpen(): Promise<core.ReconnectingWebSocket>;
|
|
77
78
|
private assertSocketIsOpen;
|
|
78
79
|
private sendJson;
|
|
79
80
|
private handleOpen;
|
|
@@ -22,8 +22,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
25
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
35
|
exports.ChatSocket = void 0;
|
|
36
|
+
const core = __importStar(require("../../../../../../core"));
|
|
27
37
|
const errors = __importStar(require("../../../../../../errors"));
|
|
28
38
|
const serializers = __importStar(require("../../../../../../serialization/index"));
|
|
29
39
|
class ChatSocket {
|
|
@@ -55,7 +65,7 @@ class ChatSocket {
|
|
|
55
65
|
};
|
|
56
66
|
this.handleError = (event) => {
|
|
57
67
|
var _a, _b, _c;
|
|
58
|
-
const message = (_a = event.message) !== null && _a !== void 0 ? _a : '
|
|
68
|
+
const message = (_a = event.message) !== null && _a !== void 0 ? _a : 'core.ReconnectingWebSocket error';
|
|
59
69
|
(_c = (_b = this.eventHandlers).error) === null || _c === void 0 ? void 0 : _c.call(_b, new Error(message));
|
|
60
70
|
};
|
|
61
71
|
this.socket = socket;
|
|
@@ -142,7 +152,7 @@ class ChatSocket {
|
|
|
142
152
|
/**
|
|
143
153
|
* @name connect
|
|
144
154
|
* @description
|
|
145
|
-
* Connect to the
|
|
155
|
+
* Connect to the core.ReconnectingWebSocket.
|
|
146
156
|
*/
|
|
147
157
|
connect() {
|
|
148
158
|
this.socket.reconnect();
|
|
@@ -163,11 +173,26 @@ class ChatSocket {
|
|
|
163
173
|
this.socket.removeEventListener('close', this.handleClose);
|
|
164
174
|
this.socket.removeEventListener('error', this.handleError);
|
|
165
175
|
}
|
|
176
|
+
tillSocketOpen() {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
if (this.socket.readyState === core.ReconnectingWebSocket.OPEN) {
|
|
179
|
+
return this.socket;
|
|
180
|
+
}
|
|
181
|
+
return new Promise((resolve, reject) => {
|
|
182
|
+
this.socket.addEventListener("open", () => {
|
|
183
|
+
resolve(this.socket);
|
|
184
|
+
});
|
|
185
|
+
this.socket.addEventListener("error", (event) => {
|
|
186
|
+
reject(event);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
}
|
|
166
191
|
assertSocketIsOpen() {
|
|
167
192
|
if (!this.socket) {
|
|
168
193
|
throw new errors.HumeError({ message: 'Socket is not connected.' });
|
|
169
194
|
}
|
|
170
|
-
if (this.socket.readyState !==
|
|
195
|
+
if (this.socket.readyState !== core.ReconnectingWebSocket.OPEN) {
|
|
171
196
|
throw new errors.HumeError({ message: 'Socket is not open.' });
|
|
172
197
|
}
|
|
173
198
|
}
|
|
@@ -58,7 +58,7 @@ class ChatGroups {
|
|
|
58
58
|
listChatGroups(request = {}, requestOptions) {
|
|
59
59
|
var _a, _b;
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const { pageNumber, pageSize, ascendingOrder } = request;
|
|
61
|
+
const { pageNumber, pageSize, ascendingOrder, configId } = request;
|
|
62
62
|
const _queryParams = {};
|
|
63
63
|
if (pageNumber != null) {
|
|
64
64
|
_queryParams["page_number"] = pageNumber.toString();
|
|
@@ -69,6 +69,9 @@ class ChatGroups {
|
|
|
69
69
|
if (ascendingOrder != null) {
|
|
70
70
|
_queryParams["ascending_order"] = ascendingOrder.toString();
|
|
71
71
|
}
|
|
72
|
+
if (configId != null) {
|
|
73
|
+
_queryParams["config_id"] = configId;
|
|
74
|
+
}
|
|
72
75
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
73
76
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, "v0/evi/chat_groups"),
|
|
74
77
|
method: "GET",
|
|
@@ -18,4 +18,8 @@ export interface ChatGroupsListChatGroupsRequest {
|
|
|
18
18
|
* Boolean to indicate if the results should be paginated in chronological order or reverse-chronological order. Defaults to true.
|
|
19
19
|
*/
|
|
20
20
|
ascendingOrder?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Filter chatgroups to only include chats that used this config in their most recent chat.
|
|
23
|
+
*/
|
|
24
|
+
configId?: string;
|
|
21
25
|
}
|
|
@@ -58,7 +58,7 @@ class Configs {
|
|
|
58
58
|
listConfigs(request = {}, requestOptions) {
|
|
59
59
|
var _a, _b;
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const { pageNumber, pageSize, restrictToMostRecent } = request;
|
|
61
|
+
const { pageNumber, pageSize, restrictToMostRecent, name } = request;
|
|
62
62
|
const _queryParams = {};
|
|
63
63
|
if (pageNumber != null) {
|
|
64
64
|
_queryParams["page_number"] = pageNumber.toString();
|
|
@@ -69,6 +69,9 @@ class Configs {
|
|
|
69
69
|
if (restrictToMostRecent != null) {
|
|
70
70
|
_queryParams["restrict_to_most_recent"] = restrictToMostRecent.toString();
|
|
71
71
|
}
|
|
72
|
+
if (name != null) {
|
|
73
|
+
_queryParams["name"] = name;
|
|
74
|
+
}
|
|
72
75
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
73
76
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, "v0/evi/configs"),
|
|
74
77
|
method: "GET",
|
|
@@ -58,7 +58,7 @@ class Prompts {
|
|
|
58
58
|
listPrompts(request = {}, requestOptions) {
|
|
59
59
|
var _a, _b;
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const { pageNumber, pageSize, restrictToMostRecent } = request;
|
|
61
|
+
const { pageNumber, pageSize, restrictToMostRecent, name } = request;
|
|
62
62
|
const _queryParams = {};
|
|
63
63
|
if (pageNumber != null) {
|
|
64
64
|
_queryParams["page_number"] = pageNumber.toString();
|
|
@@ -69,6 +69,9 @@ class Prompts {
|
|
|
69
69
|
if (restrictToMostRecent != null) {
|
|
70
70
|
_queryParams["restrict_to_most_recent"] = restrictToMostRecent.toString();
|
|
71
71
|
}
|
|
72
|
+
if (name != null) {
|
|
73
|
+
_queryParams["name"] = name;
|
|
74
|
+
}
|
|
72
75
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
73
76
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, "v0/evi/prompts"),
|
|
74
77
|
method: "GET",
|
|
@@ -61,7 +61,7 @@ class Tools {
|
|
|
61
61
|
listTools(request = {}, requestOptions) {
|
|
62
62
|
var _a, _b;
|
|
63
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const { pageNumber, pageSize, restrictToMostRecent } = request;
|
|
64
|
+
const { pageNumber, pageSize, restrictToMostRecent, name } = request;
|
|
65
65
|
const _queryParams = {};
|
|
66
66
|
if (pageNumber != null) {
|
|
67
67
|
_queryParams["page_number"] = pageNumber.toString();
|
|
@@ -72,6 +72,9 @@ class Tools {
|
|
|
72
72
|
if (restrictToMostRecent != null) {
|
|
73
73
|
_queryParams["restrict_to_most_recent"] = restrictToMostRecent.toString();
|
|
74
74
|
}
|
|
75
|
+
if (name != null) {
|
|
76
|
+
_queryParams["name"] = name;
|
|
77
|
+
}
|
|
75
78
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
76
79
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, "v0/evi/tools"),
|
|
77
80
|
method: "GET",
|
|
@@ -25,7 +25,6 @@ export * from "./ReturnLanguageModel";
|
|
|
25
25
|
export * from "./ReturnTimeoutSpec";
|
|
26
26
|
export * from "./ReturnTimeoutSpecs";
|
|
27
27
|
export * from "./ReturnVoice";
|
|
28
|
-
export * from "./ReturnPrivacySettings";
|
|
29
28
|
export * from "./PostedCustomVoiceName";
|
|
30
29
|
export * from "./ReturnPagedUserDefinedTools";
|
|
31
30
|
export * from "./ReturnPagedPrompts";
|
|
@@ -42,7 +41,6 @@ export * from "./ReturnChatGroup";
|
|
|
42
41
|
export * from "./ReturnPagedChatGroups";
|
|
43
42
|
export * from "./ReturnChatGroupPagedChats";
|
|
44
43
|
export * from "./ReturnChatGroupPagedEvents";
|
|
45
|
-
export * from "./ReturnPurgeStats";
|
|
46
44
|
export * from "./AssistantInput";
|
|
47
45
|
export * from "./AudioConfiguration";
|
|
48
46
|
export * from "./AudioInput";
|
|
@@ -41,7 +41,6 @@ __exportStar(require("./ReturnLanguageModel"), exports);
|
|
|
41
41
|
__exportStar(require("./ReturnTimeoutSpec"), exports);
|
|
42
42
|
__exportStar(require("./ReturnTimeoutSpecs"), exports);
|
|
43
43
|
__exportStar(require("./ReturnVoice"), exports);
|
|
44
|
-
__exportStar(require("./ReturnPrivacySettings"), exports);
|
|
45
44
|
__exportStar(require("./PostedCustomVoiceName"), exports);
|
|
46
45
|
__exportStar(require("./ReturnPagedUserDefinedTools"), exports);
|
|
47
46
|
__exportStar(require("./ReturnPagedPrompts"), exports);
|
|
@@ -58,7 +57,6 @@ __exportStar(require("./ReturnChatGroup"), exports);
|
|
|
58
57
|
__exportStar(require("./ReturnPagedChatGroups"), exports);
|
|
59
58
|
__exportStar(require("./ReturnChatGroupPagedChats"), exports);
|
|
60
59
|
__exportStar(require("./ReturnChatGroupPagedEvents"), exports);
|
|
61
|
-
__exportStar(require("./ReturnPurgeStats"), exports);
|
|
62
60
|
__exportStar(require("./AssistantInput"), exports);
|
|
63
61
|
__exportStar(require("./AudioConfiguration"), exports);
|
|
64
62
|
__exportStar(require("./AudioInput"), exports);
|