hume 0.14.2-beta.2 → 0.14.2-beta.4
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/Client.d.ts +3 -3
- package/Client.js +6 -6
- package/api/resources/empathicVoice/resources/chat/client/Client.d.ts +1 -1
- package/api/resources/empathicVoice/resources/chat/client/Client.js +27 -2
- package/api/resources/empathicVoice/types/ConnectSessionSettings.d.ts +8 -1
- package/api/resources/empathicVoice/types/ConnectSessionSettingsVariablesValue.d.ts +4 -0
- package/api/resources/empathicVoice/types/ConnectSessionSettingsVariablesValue.js +5 -0
- package/api/resources/empathicVoice/types/index.d.ts +1 -0
- package/api/resources/empathicVoice/types/index.js +1 -0
- package/api/resources/index.d.ts +1 -1
- package/api/resources/index.js +2 -2
- package/core/fetcher/Supplier.d.ts +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +1 -1
- package/dist/Client.d.ts +3 -3
- package/dist/Client.js +6 -6
- package/dist/api/resources/empathicVoice/resources/chat/client/Client.d.ts +1 -1
- package/dist/api/resources/empathicVoice/resources/chat/client/Client.js +27 -2
- package/dist/api/resources/empathicVoice/types/ConnectSessionSettings.d.ts +8 -1
- package/dist/api/resources/empathicVoice/types/ConnectSessionSettingsVariablesValue.d.ts +4 -0
- package/dist/api/resources/empathicVoice/types/ConnectSessionSettingsVariablesValue.js +5 -0
- package/dist/api/resources/empathicVoice/types/index.d.ts +1 -0
- package/dist/api/resources/empathicVoice/types/index.js +1 -0
- package/dist/api/resources/index.d.ts +1 -1
- package/dist/api/resources/index.js +2 -2
- package/dist/core/fetcher/Supplier.d.ts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/serialization/resources/empathicVoice/types/ConnectSessionSettings.d.ts +2 -1
- package/dist/serialization/resources/empathicVoice/types/ConnectSessionSettings.js +2 -1
- package/dist/serialization/resources/empathicVoice/types/ConnectSessionSettingsVariablesValue.d.ts +10 -0
- package/dist/serialization/resources/empathicVoice/types/ConnectSessionSettingsVariablesValue.js +45 -0
- package/dist/serialization/resources/empathicVoice/types/index.d.ts +1 -0
- package/dist/serialization/resources/empathicVoice/types/index.js +1 -0
- package/dist/serialization/resources/index.d.ts +1 -1
- package/dist/serialization/resources/index.js +2 -2
- package/dist/wrapper/HumeClient.d.ts +5 -2
- package/dist/wrapper/HumeClient.js +45 -4
- package/hume-v0.14.2-beta.2.tgz +0 -0
- package/hume-v0.14.2-beta.4.tgz +0 -0
- package/package.json +1 -1
- package/serialization/resources/empathicVoice/types/ConnectSessionSettings.d.ts +2 -1
- package/serialization/resources/empathicVoice/types/ConnectSessionSettings.js +2 -1
- package/serialization/resources/empathicVoice/types/ConnectSessionSettingsVariablesValue.d.ts +10 -0
- package/serialization/resources/empathicVoice/types/ConnectSessionSettingsVariablesValue.js +45 -0
- package/serialization/resources/empathicVoice/types/index.d.ts +1 -0
- package/serialization/resources/empathicVoice/types/index.js +1 -0
- package/serialization/resources/index.d.ts +1 -1
- package/serialization/resources/index.js +2 -2
- package/wrapper/HumeClient.d.ts +5 -2
- package/wrapper/HumeClient.js +45 -4
package/Client.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as environments from "./environments.js";
|
|
5
5
|
import * as core from "./core/index.js";
|
|
6
|
-
import { EmpathicVoice } from "./api/resources/empathicVoice/client/Client.js";
|
|
7
6
|
import { Tts } from "./api/resources/tts/client/Client.js";
|
|
7
|
+
import { EmpathicVoice } from "./api/resources/empathicVoice/client/Client.js";
|
|
8
8
|
import { ExpressionMeasurement } from "./api/resources/expressionMeasurement/client/Client.js";
|
|
9
9
|
export declare namespace HumeClient {
|
|
10
10
|
interface Options {
|
|
@@ -30,11 +30,11 @@ export declare namespace HumeClient {
|
|
|
30
30
|
}
|
|
31
31
|
export declare class HumeClient {
|
|
32
32
|
protected readonly _options: HumeClient.Options;
|
|
33
|
-
protected _empathicVoice: EmpathicVoice | undefined;
|
|
34
33
|
protected _tts: Tts | undefined;
|
|
34
|
+
protected _empathicVoice: EmpathicVoice | undefined;
|
|
35
35
|
protected _expressionMeasurement: ExpressionMeasurement | undefined;
|
|
36
36
|
constructor(_options?: HumeClient.Options);
|
|
37
|
-
get empathicVoice(): EmpathicVoice;
|
|
38
37
|
get tts(): Tts;
|
|
38
|
+
get empathicVoice(): EmpathicVoice;
|
|
39
39
|
get expressionMeasurement(): ExpressionMeasurement;
|
|
40
40
|
}
|
package/Client.js
CHANGED
|
@@ -39,8 +39,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.HumeClient = void 0;
|
|
40
40
|
const core = __importStar(require("./core/index.js"));
|
|
41
41
|
const headers_js_1 = require("./core/headers.js");
|
|
42
|
-
const Client_js_1 = require("./api/resources/
|
|
43
|
-
const Client_js_2 = require("./api/resources/
|
|
42
|
+
const Client_js_1 = require("./api/resources/tts/client/Client.js");
|
|
43
|
+
const Client_js_2 = require("./api/resources/empathicVoice/client/Client.js");
|
|
44
44
|
const Client_js_3 = require("./api/resources/expressionMeasurement/client/Client.js");
|
|
45
45
|
class HumeClient {
|
|
46
46
|
constructor(_options = {}) {
|
|
@@ -53,13 +53,13 @@ class HumeClient {
|
|
|
53
53
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
54
54
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
55
55
|
}
|
|
56
|
-
get
|
|
56
|
+
get tts() {
|
|
57
57
|
var _a;
|
|
58
|
-
return ((_a = this.
|
|
58
|
+
return ((_a = this._tts) !== null && _a !== void 0 ? _a : (this._tts = new Client_js_1.Tts(this._options)));
|
|
59
59
|
}
|
|
60
|
-
get
|
|
60
|
+
get empathicVoice() {
|
|
61
61
|
var _a;
|
|
62
|
-
return ((_a = this.
|
|
62
|
+
return ((_a = this._empathicVoice) !== null && _a !== void 0 ? _a : (this._empathicVoice = new Client_js_2.EmpathicVoice(this._options)));
|
|
63
63
|
}
|
|
64
64
|
get expressionMeasurement() {
|
|
65
65
|
var _a;
|
|
@@ -5,7 +5,7 @@ import * as Hume from "../../../../../index.js";
|
|
|
5
5
|
import { ChatSocket } from "./Socket.js";
|
|
6
6
|
export declare namespace Chat {
|
|
7
7
|
interface Options {
|
|
8
|
-
environment?: core.Supplier<environments.HumeEnvironment | environments.HumeEnvironmentUrls>;
|
|
8
|
+
environment?: core.Supplier<environments.HumeEnvironment | environments.HumeEnvironmentUrls | string>;
|
|
9
9
|
/** Specify a custom URL to connect the client to. */
|
|
10
10
|
baseUrl?: core.Supplier<string>;
|
|
11
11
|
apiKey?: core.Supplier<string | undefined>;
|
|
@@ -40,12 +40,21 @@ const core = __importStar(require("../../../../../../core/index.js"));
|
|
|
40
40
|
const headers_js_1 = require("../../../../../../core/headers.js");
|
|
41
41
|
const serializers = __importStar(require("../../../../../../serialization/index.js"));
|
|
42
42
|
const Socket_js_1 = require("./Socket.js");
|
|
43
|
+
function createHostnameWithProtocol(url) {
|
|
44
|
+
const protocol = /(https|http|wss|ws):\/\//.exec(url);
|
|
45
|
+
if (protocol) {
|
|
46
|
+
return url.replace("https://", "wss://").replace("http://", "ws://");
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return `wss://${url}`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
43
52
|
class Chat {
|
|
44
53
|
constructor(_options = {}) {
|
|
45
54
|
this._options = _options;
|
|
46
55
|
}
|
|
47
56
|
connect(args = {}) {
|
|
48
|
-
var _a
|
|
57
|
+
var _a;
|
|
49
58
|
const { accessToken, configId, configVersion, eventLimit, resumedChatGroupId, verboseTranscription, voiceId, apiKey, sessionSettings, queryParams, headers, debug, reconnectAttempts, } = args;
|
|
50
59
|
const _queryParams = {};
|
|
51
60
|
if (accessToken != null) {
|
|
@@ -89,8 +98,24 @@ class Chat {
|
|
|
89
98
|
}
|
|
90
99
|
}
|
|
91
100
|
let _headers = (0, headers_js_1.mergeHeaders)((0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, this._getCustomAuthorizationHeaders())), headers);
|
|
101
|
+
// Construct WebSocket URL with protocol conversion
|
|
102
|
+
const baseUrl = core.Supplier.get(this._options["baseUrl"]);
|
|
103
|
+
const environment = (_a = core.Supplier.get(this._options["environment"])) !== null && _a !== void 0 ? _a : environments.HumeEnvironment.Prod;
|
|
104
|
+
let websocketUrl;
|
|
105
|
+
if (baseUrl) {
|
|
106
|
+
// baseUrl takes precedence - apply protocol conversion
|
|
107
|
+
websocketUrl = core.url.join(createHostnameWithProtocol(baseUrl), "/v0/evi/chat");
|
|
108
|
+
}
|
|
109
|
+
else if (typeof environment === "string") {
|
|
110
|
+
// String environment - apply protocol conversion
|
|
111
|
+
websocketUrl = core.url.join(createHostnameWithProtocol(environment), "/v0/evi/chat");
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// Structured environment object - use .evi property directly
|
|
115
|
+
websocketUrl = core.url.join(environment.evi, "/chat");
|
|
116
|
+
}
|
|
92
117
|
const socket = new core.ReconnectingWebSocket({
|
|
93
|
-
url:
|
|
118
|
+
url: websocketUrl,
|
|
94
119
|
protocols: [],
|
|
95
120
|
queryParameters: _queryParams,
|
|
96
121
|
headers: _headers,
|
|
@@ -9,6 +9,13 @@ export interface ConnectSessionSettings {
|
|
|
9
9
|
eventLimit?: number;
|
|
10
10
|
languageModelApiKey?: string;
|
|
11
11
|
systemPrompt?: string;
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* This field allows you to assign values to dynamic variables referenced in your system prompt.
|
|
14
|
+
*
|
|
15
|
+
* Each key represents the variable name, and the corresponding value is the specific content you wish to assign to that variable within the session. While the values for variables can be strings, numbers, or booleans, the value will ultimately be converted to a string when injected into your system prompt.
|
|
16
|
+
*
|
|
17
|
+
* Using this field, you can personalize responses based on session-specific details. For more guidance, see our [guide on using dynamic variables](/docs/speech-to-speech-evi/features/dynamic-variables).
|
|
18
|
+
*/
|
|
19
|
+
variables?: Record<string, Hume.empathicVoice.ConnectSessionSettingsVariablesValue>;
|
|
13
20
|
voiceId?: string;
|
|
14
21
|
}
|
|
@@ -35,6 +35,7 @@ export * from "./UserMessage.js";
|
|
|
35
35
|
export * from "./JsonMessage.js";
|
|
36
36
|
export * from "./ConnectSessionSettingsAudio.js";
|
|
37
37
|
export * from "./ConnectSessionSettingsContext.js";
|
|
38
|
+
export * from "./ConnectSessionSettingsVariablesValue.js";
|
|
38
39
|
export * from "./ConnectSessionSettings.js";
|
|
39
40
|
export * from "./HttpValidationError.js";
|
|
40
41
|
export * from "./LanguageModelType.js";
|
|
@@ -51,6 +51,7 @@ __exportStar(require("./UserMessage.js"), exports);
|
|
|
51
51
|
__exportStar(require("./JsonMessage.js"), exports);
|
|
52
52
|
__exportStar(require("./ConnectSessionSettingsAudio.js"), exports);
|
|
53
53
|
__exportStar(require("./ConnectSessionSettingsContext.js"), exports);
|
|
54
|
+
__exportStar(require("./ConnectSessionSettingsVariablesValue.js"), exports);
|
|
54
55
|
__exportStar(require("./ConnectSessionSettings.js"), exports);
|
|
55
56
|
__exportStar(require("./HttpValidationError.js"), exports);
|
|
56
57
|
__exportStar(require("./LanguageModelType.js"), exports);
|
package/api/resources/index.d.ts
CHANGED
package/api/resources/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.expressionMeasurement = exports.
|
|
37
|
-
exports.empathicVoice = __importStar(require("./empathicVoice/index.js"));
|
|
36
|
+
exports.expressionMeasurement = exports.empathicVoice = exports.tts = void 0;
|
|
38
37
|
exports.tts = __importStar(require("./tts/index.js"));
|
|
38
|
+
exports.empathicVoice = __importStar(require("./empathicVoice/index.js"));
|
|
39
39
|
exports.expressionMeasurement = __importStar(require("./expressionMeasurement/index.js"));
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
export type Supplier<T> = T | (() => T);
|
|
3
3
|
export declare const Supplier: {
|
|
4
4
|
get: <T>(supplier: Supplier<T>) => T;
|
|
5
|
-
map: <T, U>(supplier: Supplier<T>, f: (value: T) =>
|
|
5
|
+
map: <T, U, R = U>(supplier: Supplier<T>, f: (value: T) => R) => Supplier<R>;
|
|
6
6
|
};
|
package/core/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export * from "./runtime/index.js";
|
|
|
3
3
|
export * as url from "./url/index.js";
|
|
4
4
|
export * as serialization from "./schemas/index.js";
|
|
5
5
|
export * from "./websocket/index.js";
|
|
6
|
+
export * from "./stream/index.js";
|
|
6
7
|
export * from "./utils/index.js";
|
|
7
8
|
export * from "./pagination/index.js";
|
|
8
|
-
export * from "./stream/index.js";
|
|
9
9
|
export * from "./form-data-utils/index.js";
|
|
10
10
|
export * as file from "./file/index.js";
|
package/core/index.js
CHANGED
|
@@ -42,8 +42,8 @@ __exportStar(require("./runtime/index.js"), exports);
|
|
|
42
42
|
exports.url = __importStar(require("./url/index.js"));
|
|
43
43
|
exports.serialization = __importStar(require("./schemas/index.js"));
|
|
44
44
|
__exportStar(require("./websocket/index.js"), exports);
|
|
45
|
+
__exportStar(require("./stream/index.js"), exports);
|
|
45
46
|
__exportStar(require("./utils/index.js"), exports);
|
|
46
47
|
__exportStar(require("./pagination/index.js"), exports);
|
|
47
|
-
__exportStar(require("./stream/index.js"), exports);
|
|
48
48
|
__exportStar(require("./form-data-utils/index.js"), exports);
|
|
49
49
|
exports.file = __importStar(require("./file/index.js"));
|
package/dist/Client.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as environments from "./environments.js";
|
|
5
5
|
import * as core from "./core/index.js";
|
|
6
|
-
import { EmpathicVoice } from "./api/resources/empathicVoice/client/Client.js";
|
|
7
6
|
import { Tts } from "./api/resources/tts/client/Client.js";
|
|
7
|
+
import { EmpathicVoice } from "./api/resources/empathicVoice/client/Client.js";
|
|
8
8
|
import { ExpressionMeasurement } from "./api/resources/expressionMeasurement/client/Client.js";
|
|
9
9
|
export declare namespace HumeClient {
|
|
10
10
|
interface Options {
|
|
@@ -30,11 +30,11 @@ export declare namespace HumeClient {
|
|
|
30
30
|
}
|
|
31
31
|
export declare class HumeClient {
|
|
32
32
|
protected readonly _options: HumeClient.Options;
|
|
33
|
-
protected _empathicVoice: EmpathicVoice | undefined;
|
|
34
33
|
protected _tts: Tts | undefined;
|
|
34
|
+
protected _empathicVoice: EmpathicVoice | undefined;
|
|
35
35
|
protected _expressionMeasurement: ExpressionMeasurement | undefined;
|
|
36
36
|
constructor(_options?: HumeClient.Options);
|
|
37
|
-
get empathicVoice(): EmpathicVoice;
|
|
38
37
|
get tts(): Tts;
|
|
38
|
+
get empathicVoice(): EmpathicVoice;
|
|
39
39
|
get expressionMeasurement(): ExpressionMeasurement;
|
|
40
40
|
}
|
package/dist/Client.js
CHANGED
|
@@ -39,8 +39,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.HumeClient = void 0;
|
|
40
40
|
const core = __importStar(require("./core/index.js"));
|
|
41
41
|
const headers_js_1 = require("./core/headers.js");
|
|
42
|
-
const Client_js_1 = require("./api/resources/
|
|
43
|
-
const Client_js_2 = require("./api/resources/
|
|
42
|
+
const Client_js_1 = require("./api/resources/tts/client/Client.js");
|
|
43
|
+
const Client_js_2 = require("./api/resources/empathicVoice/client/Client.js");
|
|
44
44
|
const Client_js_3 = require("./api/resources/expressionMeasurement/client/Client.js");
|
|
45
45
|
class HumeClient {
|
|
46
46
|
constructor(_options = {}) {
|
|
@@ -53,13 +53,13 @@ class HumeClient {
|
|
|
53
53
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
54
54
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
55
55
|
}
|
|
56
|
-
get
|
|
56
|
+
get tts() {
|
|
57
57
|
var _a;
|
|
58
|
-
return ((_a = this.
|
|
58
|
+
return ((_a = this._tts) !== null && _a !== void 0 ? _a : (this._tts = new Client_js_1.Tts(this._options)));
|
|
59
59
|
}
|
|
60
|
-
get
|
|
60
|
+
get empathicVoice() {
|
|
61
61
|
var _a;
|
|
62
|
-
return ((_a = this.
|
|
62
|
+
return ((_a = this._empathicVoice) !== null && _a !== void 0 ? _a : (this._empathicVoice = new Client_js_2.EmpathicVoice(this._options)));
|
|
63
63
|
}
|
|
64
64
|
get expressionMeasurement() {
|
|
65
65
|
var _a;
|
|
@@ -5,7 +5,7 @@ import * as Hume from "../../../../../index.js";
|
|
|
5
5
|
import { ChatSocket } from "./Socket.js";
|
|
6
6
|
export declare namespace Chat {
|
|
7
7
|
interface Options {
|
|
8
|
-
environment?: core.Supplier<environments.HumeEnvironment | environments.HumeEnvironmentUrls>;
|
|
8
|
+
environment?: core.Supplier<environments.HumeEnvironment | environments.HumeEnvironmentUrls | string>;
|
|
9
9
|
/** Specify a custom URL to connect the client to. */
|
|
10
10
|
baseUrl?: core.Supplier<string>;
|
|
11
11
|
apiKey?: core.Supplier<string | undefined>;
|
|
@@ -40,12 +40,21 @@ const core = __importStar(require("../../../../../../core/index.js"));
|
|
|
40
40
|
const headers_js_1 = require("../../../../../../core/headers.js");
|
|
41
41
|
const serializers = __importStar(require("../../../../../../serialization/index.js"));
|
|
42
42
|
const Socket_js_1 = require("./Socket.js");
|
|
43
|
+
function createHostnameWithProtocol(url) {
|
|
44
|
+
const protocol = /(https|http|wss|ws):\/\//.exec(url);
|
|
45
|
+
if (protocol) {
|
|
46
|
+
return url.replace("https://", "wss://").replace("http://", "ws://");
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return `wss://${url}`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
43
52
|
class Chat {
|
|
44
53
|
constructor(_options = {}) {
|
|
45
54
|
this._options = _options;
|
|
46
55
|
}
|
|
47
56
|
connect(args = {}) {
|
|
48
|
-
var _a
|
|
57
|
+
var _a;
|
|
49
58
|
const { accessToken, configId, configVersion, eventLimit, resumedChatGroupId, verboseTranscription, voiceId, apiKey, sessionSettings, queryParams, headers, debug, reconnectAttempts, } = args;
|
|
50
59
|
const _queryParams = {};
|
|
51
60
|
if (accessToken != null) {
|
|
@@ -89,8 +98,24 @@ class Chat {
|
|
|
89
98
|
}
|
|
90
99
|
}
|
|
91
100
|
let _headers = (0, headers_js_1.mergeHeaders)((0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, this._getCustomAuthorizationHeaders())), headers);
|
|
101
|
+
// Construct WebSocket URL with protocol conversion
|
|
102
|
+
const baseUrl = core.Supplier.get(this._options["baseUrl"]);
|
|
103
|
+
const environment = (_a = core.Supplier.get(this._options["environment"])) !== null && _a !== void 0 ? _a : environments.HumeEnvironment.Prod;
|
|
104
|
+
let websocketUrl;
|
|
105
|
+
if (baseUrl) {
|
|
106
|
+
// baseUrl takes precedence - apply protocol conversion
|
|
107
|
+
websocketUrl = core.url.join(createHostnameWithProtocol(baseUrl), "/v0/evi/chat");
|
|
108
|
+
}
|
|
109
|
+
else if (typeof environment === "string") {
|
|
110
|
+
// String environment - apply protocol conversion
|
|
111
|
+
websocketUrl = core.url.join(createHostnameWithProtocol(environment), "/v0/evi/chat");
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// Structured environment object - use .evi property directly
|
|
115
|
+
websocketUrl = core.url.join(environment.evi, "/chat");
|
|
116
|
+
}
|
|
92
117
|
const socket = new core.ReconnectingWebSocket({
|
|
93
|
-
url:
|
|
118
|
+
url: websocketUrl,
|
|
94
119
|
protocols: [],
|
|
95
120
|
queryParameters: _queryParams,
|
|
96
121
|
headers: _headers,
|
|
@@ -9,6 +9,13 @@ export interface ConnectSessionSettings {
|
|
|
9
9
|
eventLimit?: number;
|
|
10
10
|
languageModelApiKey?: string;
|
|
11
11
|
systemPrompt?: string;
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* This field allows you to assign values to dynamic variables referenced in your system prompt.
|
|
14
|
+
*
|
|
15
|
+
* Each key represents the variable name, and the corresponding value is the specific content you wish to assign to that variable within the session. While the values for variables can be strings, numbers, or booleans, the value will ultimately be converted to a string when injected into your system prompt.
|
|
16
|
+
*
|
|
17
|
+
* Using this field, you can personalize responses based on session-specific details. For more guidance, see our [guide on using dynamic variables](/docs/speech-to-speech-evi/features/dynamic-variables).
|
|
18
|
+
*/
|
|
19
|
+
variables?: Record<string, Hume.empathicVoice.ConnectSessionSettingsVariablesValue>;
|
|
13
20
|
voiceId?: string;
|
|
14
21
|
}
|
|
@@ -35,6 +35,7 @@ export * from "./UserMessage.js";
|
|
|
35
35
|
export * from "./JsonMessage.js";
|
|
36
36
|
export * from "./ConnectSessionSettingsAudio.js";
|
|
37
37
|
export * from "./ConnectSessionSettingsContext.js";
|
|
38
|
+
export * from "./ConnectSessionSettingsVariablesValue.js";
|
|
38
39
|
export * from "./ConnectSessionSettings.js";
|
|
39
40
|
export * from "./HttpValidationError.js";
|
|
40
41
|
export * from "./LanguageModelType.js";
|
|
@@ -51,6 +51,7 @@ __exportStar(require("./UserMessage.js"), exports);
|
|
|
51
51
|
__exportStar(require("./JsonMessage.js"), exports);
|
|
52
52
|
__exportStar(require("./ConnectSessionSettingsAudio.js"), exports);
|
|
53
53
|
__exportStar(require("./ConnectSessionSettingsContext.js"), exports);
|
|
54
|
+
__exportStar(require("./ConnectSessionSettingsVariablesValue.js"), exports);
|
|
54
55
|
__exportStar(require("./ConnectSessionSettings.js"), exports);
|
|
55
56
|
__exportStar(require("./HttpValidationError.js"), exports);
|
|
56
57
|
__exportStar(require("./LanguageModelType.js"), exports);
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.expressionMeasurement = exports.
|
|
37
|
-
exports.empathicVoice = __importStar(require("./empathicVoice/index.js"));
|
|
36
|
+
exports.expressionMeasurement = exports.empathicVoice = exports.tts = void 0;
|
|
38
37
|
exports.tts = __importStar(require("./tts/index.js"));
|
|
38
|
+
exports.empathicVoice = __importStar(require("./empathicVoice/index.js"));
|
|
39
39
|
exports.expressionMeasurement = __importStar(require("./expressionMeasurement/index.js"));
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
export type Supplier<T> = T | (() => T);
|
|
3
3
|
export declare const Supplier: {
|
|
4
4
|
get: <T>(supplier: Supplier<T>) => T;
|
|
5
|
-
map: <T, U>(supplier: Supplier<T>, f: (value: T) =>
|
|
5
|
+
map: <T, U, R = U>(supplier: Supplier<T>, f: (value: T) => R) => Supplier<R>;
|
|
6
6
|
};
|
package/dist/core/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export * from "./runtime/index.js";
|
|
|
3
3
|
export * as url from "./url/index.js";
|
|
4
4
|
export * as serialization from "./schemas/index.js";
|
|
5
5
|
export * from "./websocket/index.js";
|
|
6
|
+
export * from "./stream/index.js";
|
|
6
7
|
export * from "./utils/index.js";
|
|
7
8
|
export * from "./pagination/index.js";
|
|
8
|
-
export * from "./stream/index.js";
|
|
9
9
|
export * from "./form-data-utils/index.js";
|
|
10
10
|
export * as file from "./file/index.js";
|
package/dist/core/index.js
CHANGED
|
@@ -42,8 +42,8 @@ __exportStar(require("./runtime/index.js"), exports);
|
|
|
42
42
|
exports.url = __importStar(require("./url/index.js"));
|
|
43
43
|
exports.serialization = __importStar(require("./schemas/index.js"));
|
|
44
44
|
__exportStar(require("./websocket/index.js"), exports);
|
|
45
|
+
__exportStar(require("./stream/index.js"), exports);
|
|
45
46
|
__exportStar(require("./utils/index.js"), exports);
|
|
46
47
|
__exportStar(require("./pagination/index.js"), exports);
|
|
47
|
-
__exportStar(require("./stream/index.js"), exports);
|
|
48
48
|
__exportStar(require("./form-data-utils/index.js"), exports);
|
|
49
49
|
exports.file = __importStar(require("./file/index.js"));
|
|
@@ -6,6 +6,7 @@ import * as Hume from "../../../../api/index.js";
|
|
|
6
6
|
import * as core from "../../../../core/index.js";
|
|
7
7
|
import { ConnectSessionSettingsAudio } from "./ConnectSessionSettingsAudio.js";
|
|
8
8
|
import { ConnectSessionSettingsContext } from "./ConnectSessionSettingsContext.js";
|
|
9
|
+
import { ConnectSessionSettingsVariablesValue } from "./ConnectSessionSettingsVariablesValue.js";
|
|
9
10
|
export declare const ConnectSessionSettings: core.serialization.ObjectSchema<serializers.empathicVoice.ConnectSessionSettings.Raw, Hume.empathicVoice.ConnectSessionSettings>;
|
|
10
11
|
export declare namespace ConnectSessionSettings {
|
|
11
12
|
interface Raw {
|
|
@@ -15,7 +16,7 @@ export declare namespace ConnectSessionSettings {
|
|
|
15
16
|
event_limit?: number | null;
|
|
16
17
|
language_model_api_key?: string | null;
|
|
17
18
|
system_prompt?: string | null;
|
|
18
|
-
variables?: string | null;
|
|
19
|
+
variables?: Record<string, ConnectSessionSettingsVariablesValue.Raw> | null;
|
|
19
20
|
voice_id?: string | null;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
@@ -40,6 +40,7 @@ exports.ConnectSessionSettings = void 0;
|
|
|
40
40
|
const core = __importStar(require("../../../../core/index.js"));
|
|
41
41
|
const ConnectSessionSettingsAudio_js_1 = require("./ConnectSessionSettingsAudio.js");
|
|
42
42
|
const ConnectSessionSettingsContext_js_1 = require("./ConnectSessionSettingsContext.js");
|
|
43
|
+
const ConnectSessionSettingsVariablesValue_js_1 = require("./ConnectSessionSettingsVariablesValue.js");
|
|
43
44
|
exports.ConnectSessionSettings = core.serialization.object({
|
|
44
45
|
audio: ConnectSessionSettingsAudio_js_1.ConnectSessionSettingsAudio.optional(),
|
|
45
46
|
context: ConnectSessionSettingsContext_js_1.ConnectSessionSettingsContext.optional(),
|
|
@@ -47,6 +48,6 @@ exports.ConnectSessionSettings = core.serialization.object({
|
|
|
47
48
|
eventLimit: core.serialization.property("event_limit", core.serialization.number().optional()),
|
|
48
49
|
languageModelApiKey: core.serialization.property("language_model_api_key", core.serialization.string().optional()),
|
|
49
50
|
systemPrompt: core.serialization.property("system_prompt", core.serialization.string().optional()),
|
|
50
|
-
variables: core.serialization.string().optional(),
|
|
51
|
+
variables: core.serialization.record(core.serialization.string(), ConnectSessionSettingsVariablesValue_js_1.ConnectSessionSettingsVariablesValue).optional(),
|
|
51
52
|
voiceId: core.serialization.property("voice_id", core.serialization.string().optional()),
|
|
52
53
|
});
|
package/dist/serialization/resources/empathicVoice/types/ConnectSessionSettingsVariablesValue.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "../../../index.js";
|
|
5
|
+
import * as Hume from "../../../../api/index.js";
|
|
6
|
+
import * as core from "../../../../core/index.js";
|
|
7
|
+
export declare const ConnectSessionSettingsVariablesValue: core.serialization.Schema<serializers.empathicVoice.ConnectSessionSettingsVariablesValue.Raw, Hume.empathicVoice.ConnectSessionSettingsVariablesValue>;
|
|
8
|
+
export declare namespace ConnectSessionSettingsVariablesValue {
|
|
9
|
+
type Raw = string | number | boolean;
|
|
10
|
+
}
|
package/dist/serialization/resources/empathicVoice/types/ConnectSessionSettingsVariablesValue.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ConnectSessionSettingsVariablesValue = void 0;
|
|
40
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
41
|
+
exports.ConnectSessionSettingsVariablesValue = core.serialization.undiscriminatedUnion([
|
|
42
|
+
core.serialization.string(),
|
|
43
|
+
core.serialization.number(),
|
|
44
|
+
core.serialization.boolean(),
|
|
45
|
+
]);
|
|
@@ -35,6 +35,7 @@ export * from "./UserMessage.js";
|
|
|
35
35
|
export * from "./JsonMessage.js";
|
|
36
36
|
export * from "./ConnectSessionSettingsAudio.js";
|
|
37
37
|
export * from "./ConnectSessionSettingsContext.js";
|
|
38
|
+
export * from "./ConnectSessionSettingsVariablesValue.js";
|
|
38
39
|
export * from "./ConnectSessionSettings.js";
|
|
39
40
|
export * from "./HttpValidationError.js";
|
|
40
41
|
export * from "./LanguageModelType.js";
|
|
@@ -51,6 +51,7 @@ __exportStar(require("./UserMessage.js"), exports);
|
|
|
51
51
|
__exportStar(require("./JsonMessage.js"), exports);
|
|
52
52
|
__exportStar(require("./ConnectSessionSettingsAudio.js"), exports);
|
|
53
53
|
__exportStar(require("./ConnectSessionSettingsContext.js"), exports);
|
|
54
|
+
__exportStar(require("./ConnectSessionSettingsVariablesValue.js"), exports);
|
|
54
55
|
__exportStar(require("./ConnectSessionSettings.js"), exports);
|
|
55
56
|
__exportStar(require("./HttpValidationError.js"), exports);
|
|
56
57
|
__exportStar(require("./LanguageModelType.js"), exports);
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.expressionMeasurement = exports.
|
|
37
|
-
exports.empathicVoice = __importStar(require("./empathicVoice/index.js"));
|
|
36
|
+
exports.expressionMeasurement = exports.empathicVoice = exports.tts = void 0;
|
|
38
37
|
exports.tts = __importStar(require("./tts/index.js"));
|
|
38
|
+
exports.empathicVoice = __importStar(require("./empathicVoice/index.js"));
|
|
39
39
|
exports.expressionMeasurement = __importStar(require("./expressionMeasurement/index.js"));
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { HumeClient as FernClient } from "../Client";
|
|
2
2
|
import * as core from "../core/index.js";
|
|
3
3
|
import { ExpressionMeasurement } from "./expressionMeasurement/ExpressionMeasurementClient";
|
|
4
|
+
import * as environments from "../environments.js";
|
|
4
5
|
export declare namespace HumeClient {
|
|
5
|
-
type Options = FernClient.Options & {
|
|
6
|
+
type Options = Omit<FernClient.Options, 'environment'> & {
|
|
6
7
|
secretKey?: string;
|
|
7
8
|
accessToken?: string;
|
|
8
9
|
} & ({
|
|
9
10
|
accessToken: NonNullable<core.Supplier<string>>;
|
|
10
11
|
} | {
|
|
11
12
|
apiKey: NonNullable<FernClient.Options["apiKey"]>;
|
|
12
|
-
})
|
|
13
|
+
}) & {
|
|
14
|
+
environment: core.Supplier<environments.HumeEnvironment | environments.HumeEnvironmentUrls | string>;
|
|
15
|
+
};
|
|
13
16
|
}
|
|
14
17
|
export declare class HumeClient extends FernClient {
|
|
15
18
|
constructor(_options: HumeClient.Options);
|
|
@@ -32,6 +32,17 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
+
t[p] = s[p];
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
+
t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
35
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
47
|
exports.HumeClient = void 0;
|
|
37
48
|
const Client_1 = require("../Client");
|
|
@@ -39,6 +50,10 @@ const core = __importStar(require("../core/index.js"));
|
|
|
39
50
|
const ExpressionMeasurementClient_1 = require("./expressionMeasurement/ExpressionMeasurementClient");
|
|
40
51
|
class HumeClient extends Client_1.HumeClient {
|
|
41
52
|
constructor(_options) {
|
|
53
|
+
var _a;
|
|
54
|
+
let options;
|
|
55
|
+
let oldEnvironment;
|
|
56
|
+
(_a = _options || {}, { environment: oldEnvironment } = _a, options = __rest(_a, ["environment"]));
|
|
42
57
|
// Check if both accessToken and Authorization header are provided (case-insensitive)
|
|
43
58
|
if (_options.accessToken && _options.headers) {
|
|
44
59
|
const hasAuthHeader = Object.keys(_options.headers).some((key) => key.toLowerCase() === "authorization");
|
|
@@ -46,12 +61,38 @@ class HumeClient extends Client_1.HumeClient {
|
|
|
46
61
|
throw new Error("Cannot provide both 'accessToken' and 'headers.Authorization'. Please use only one.");
|
|
47
62
|
}
|
|
48
63
|
}
|
|
49
|
-
// If accessToken is provided, add Authorization header
|
|
50
|
-
let optionsWithAuth = _options || {};
|
|
51
64
|
if (_options.accessToken) {
|
|
52
|
-
|
|
65
|
+
options.headers = Object.assign(Object.assign({}, options.headers), { Authorization: core.Supplier.map(_options.accessToken, (token) => `Bearer ${token}`) });
|
|
66
|
+
}
|
|
67
|
+
// Allow setting a single url http://... or https://... for environment'
|
|
68
|
+
if (oldEnvironment) {
|
|
69
|
+
const environment = _options.environment ? core.Supplier.map(_options.environment, (e) => {
|
|
70
|
+
if (typeof e === "string") {
|
|
71
|
+
if (e.startsWith("http://")) {
|
|
72
|
+
return {
|
|
73
|
+
base: e,
|
|
74
|
+
evi: e.replace('http://', 'ws://') + "/v0/evi",
|
|
75
|
+
tts: e.replace('http://', 'ws://') + "/v0/tts",
|
|
76
|
+
stream: e.replace('http://', 'ws://') + "/v0/stream",
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (e.startsWith("https://")) {
|
|
80
|
+
return {
|
|
81
|
+
base: e,
|
|
82
|
+
evi: e.replace('https://', 'wss://') + "/v0/evi",
|
|
83
|
+
tts: e.replace('https://', 'wss://') + "/v0/tts",
|
|
84
|
+
stream: e.replace('https://', 'wss://') + "/v0/stream",
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
throw new Error(`Invalid environment URL: ${e}. Must start with http:// or https://`);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return e;
|
|
91
|
+
}
|
|
92
|
+
}) : undefined;
|
|
93
|
+
options.environment = environment;
|
|
53
94
|
}
|
|
54
|
-
super(
|
|
95
|
+
super(options);
|
|
55
96
|
}
|
|
56
97
|
get expressionMeasurement() {
|
|
57
98
|
var _a;
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import * as Hume from "../../../../api/index.js";
|
|
|
6
6
|
import * as core from "../../../../core/index.js";
|
|
7
7
|
import { ConnectSessionSettingsAudio } from "./ConnectSessionSettingsAudio.js";
|
|
8
8
|
import { ConnectSessionSettingsContext } from "./ConnectSessionSettingsContext.js";
|
|
9
|
+
import { ConnectSessionSettingsVariablesValue } from "./ConnectSessionSettingsVariablesValue.js";
|
|
9
10
|
export declare const ConnectSessionSettings: core.serialization.ObjectSchema<serializers.empathicVoice.ConnectSessionSettings.Raw, Hume.empathicVoice.ConnectSessionSettings>;
|
|
10
11
|
export declare namespace ConnectSessionSettings {
|
|
11
12
|
interface Raw {
|
|
@@ -15,7 +16,7 @@ export declare namespace ConnectSessionSettings {
|
|
|
15
16
|
event_limit?: number | null;
|
|
16
17
|
language_model_api_key?: string | null;
|
|
17
18
|
system_prompt?: string | null;
|
|
18
|
-
variables?: string | null;
|
|
19
|
+
variables?: Record<string, ConnectSessionSettingsVariablesValue.Raw> | null;
|
|
19
20
|
voice_id?: string | null;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
@@ -40,6 +40,7 @@ exports.ConnectSessionSettings = void 0;
|
|
|
40
40
|
const core = __importStar(require("../../../../core/index.js"));
|
|
41
41
|
const ConnectSessionSettingsAudio_js_1 = require("./ConnectSessionSettingsAudio.js");
|
|
42
42
|
const ConnectSessionSettingsContext_js_1 = require("./ConnectSessionSettingsContext.js");
|
|
43
|
+
const ConnectSessionSettingsVariablesValue_js_1 = require("./ConnectSessionSettingsVariablesValue.js");
|
|
43
44
|
exports.ConnectSessionSettings = core.serialization.object({
|
|
44
45
|
audio: ConnectSessionSettingsAudio_js_1.ConnectSessionSettingsAudio.optional(),
|
|
45
46
|
context: ConnectSessionSettingsContext_js_1.ConnectSessionSettingsContext.optional(),
|
|
@@ -47,6 +48,6 @@ exports.ConnectSessionSettings = core.serialization.object({
|
|
|
47
48
|
eventLimit: core.serialization.property("event_limit", core.serialization.number().optional()),
|
|
48
49
|
languageModelApiKey: core.serialization.property("language_model_api_key", core.serialization.string().optional()),
|
|
49
50
|
systemPrompt: core.serialization.property("system_prompt", core.serialization.string().optional()),
|
|
50
|
-
variables: core.serialization.string().optional(),
|
|
51
|
+
variables: core.serialization.record(core.serialization.string(), ConnectSessionSettingsVariablesValue_js_1.ConnectSessionSettingsVariablesValue).optional(),
|
|
51
52
|
voiceId: core.serialization.property("voice_id", core.serialization.string().optional()),
|
|
52
53
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "../../../index.js";
|
|
5
|
+
import * as Hume from "../../../../api/index.js";
|
|
6
|
+
import * as core from "../../../../core/index.js";
|
|
7
|
+
export declare const ConnectSessionSettingsVariablesValue: core.serialization.Schema<serializers.empathicVoice.ConnectSessionSettingsVariablesValue.Raw, Hume.empathicVoice.ConnectSessionSettingsVariablesValue>;
|
|
8
|
+
export declare namespace ConnectSessionSettingsVariablesValue {
|
|
9
|
+
type Raw = string | number | boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ConnectSessionSettingsVariablesValue = void 0;
|
|
40
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
41
|
+
exports.ConnectSessionSettingsVariablesValue = core.serialization.undiscriminatedUnion([
|
|
42
|
+
core.serialization.string(),
|
|
43
|
+
core.serialization.number(),
|
|
44
|
+
core.serialization.boolean(),
|
|
45
|
+
]);
|
|
@@ -35,6 +35,7 @@ export * from "./UserMessage.js";
|
|
|
35
35
|
export * from "./JsonMessage.js";
|
|
36
36
|
export * from "./ConnectSessionSettingsAudio.js";
|
|
37
37
|
export * from "./ConnectSessionSettingsContext.js";
|
|
38
|
+
export * from "./ConnectSessionSettingsVariablesValue.js";
|
|
38
39
|
export * from "./ConnectSessionSettings.js";
|
|
39
40
|
export * from "./HttpValidationError.js";
|
|
40
41
|
export * from "./LanguageModelType.js";
|
|
@@ -51,6 +51,7 @@ __exportStar(require("./UserMessage.js"), exports);
|
|
|
51
51
|
__exportStar(require("./JsonMessage.js"), exports);
|
|
52
52
|
__exportStar(require("./ConnectSessionSettingsAudio.js"), exports);
|
|
53
53
|
__exportStar(require("./ConnectSessionSettingsContext.js"), exports);
|
|
54
|
+
__exportStar(require("./ConnectSessionSettingsVariablesValue.js"), exports);
|
|
54
55
|
__exportStar(require("./ConnectSessionSettings.js"), exports);
|
|
55
56
|
__exportStar(require("./HttpValidationError.js"), exports);
|
|
56
57
|
__exportStar(require("./LanguageModelType.js"), exports);
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.expressionMeasurement = exports.
|
|
37
|
-
exports.empathicVoice = __importStar(require("./empathicVoice/index.js"));
|
|
36
|
+
exports.expressionMeasurement = exports.empathicVoice = exports.tts = void 0;
|
|
38
37
|
exports.tts = __importStar(require("./tts/index.js"));
|
|
38
|
+
exports.empathicVoice = __importStar(require("./empathicVoice/index.js"));
|
|
39
39
|
exports.expressionMeasurement = __importStar(require("./expressionMeasurement/index.js"));
|
package/wrapper/HumeClient.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { HumeClient as FernClient } from "../Client";
|
|
2
2
|
import * as core from "../core/index.js";
|
|
3
3
|
import { ExpressionMeasurement } from "./expressionMeasurement/ExpressionMeasurementClient";
|
|
4
|
+
import * as environments from "../environments.js";
|
|
4
5
|
export declare namespace HumeClient {
|
|
5
|
-
type Options = FernClient.Options & {
|
|
6
|
+
type Options = Omit<FernClient.Options, 'environment'> & {
|
|
6
7
|
secretKey?: string;
|
|
7
8
|
accessToken?: string;
|
|
8
9
|
} & ({
|
|
9
10
|
accessToken: NonNullable<core.Supplier<string>>;
|
|
10
11
|
} | {
|
|
11
12
|
apiKey: NonNullable<FernClient.Options["apiKey"]>;
|
|
12
|
-
})
|
|
13
|
+
}) & {
|
|
14
|
+
environment: core.Supplier<environments.HumeEnvironment | environments.HumeEnvironmentUrls | string>;
|
|
15
|
+
};
|
|
13
16
|
}
|
|
14
17
|
export declare class HumeClient extends FernClient {
|
|
15
18
|
constructor(_options: HumeClient.Options);
|
package/wrapper/HumeClient.js
CHANGED
|
@@ -32,6 +32,17 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
+
t[p] = s[p];
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
+
t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
35
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
47
|
exports.HumeClient = void 0;
|
|
37
48
|
const Client_1 = require("../Client");
|
|
@@ -39,6 +50,10 @@ const core = __importStar(require("../core/index.js"));
|
|
|
39
50
|
const ExpressionMeasurementClient_1 = require("./expressionMeasurement/ExpressionMeasurementClient");
|
|
40
51
|
class HumeClient extends Client_1.HumeClient {
|
|
41
52
|
constructor(_options) {
|
|
53
|
+
var _a;
|
|
54
|
+
let options;
|
|
55
|
+
let oldEnvironment;
|
|
56
|
+
(_a = _options || {}, { environment: oldEnvironment } = _a, options = __rest(_a, ["environment"]));
|
|
42
57
|
// Check if both accessToken and Authorization header are provided (case-insensitive)
|
|
43
58
|
if (_options.accessToken && _options.headers) {
|
|
44
59
|
const hasAuthHeader = Object.keys(_options.headers).some((key) => key.toLowerCase() === "authorization");
|
|
@@ -46,12 +61,38 @@ class HumeClient extends Client_1.HumeClient {
|
|
|
46
61
|
throw new Error("Cannot provide both 'accessToken' and 'headers.Authorization'. Please use only one.");
|
|
47
62
|
}
|
|
48
63
|
}
|
|
49
|
-
// If accessToken is provided, add Authorization header
|
|
50
|
-
let optionsWithAuth = _options || {};
|
|
51
64
|
if (_options.accessToken) {
|
|
52
|
-
|
|
65
|
+
options.headers = Object.assign(Object.assign({}, options.headers), { Authorization: core.Supplier.map(_options.accessToken, (token) => `Bearer ${token}`) });
|
|
66
|
+
}
|
|
67
|
+
// Allow setting a single url http://... or https://... for environment'
|
|
68
|
+
if (oldEnvironment) {
|
|
69
|
+
const environment = _options.environment ? core.Supplier.map(_options.environment, (e) => {
|
|
70
|
+
if (typeof e === "string") {
|
|
71
|
+
if (e.startsWith("http://")) {
|
|
72
|
+
return {
|
|
73
|
+
base: e,
|
|
74
|
+
evi: e.replace('http://', 'ws://') + "/v0/evi",
|
|
75
|
+
tts: e.replace('http://', 'ws://') + "/v0/tts",
|
|
76
|
+
stream: e.replace('http://', 'ws://') + "/v0/stream",
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (e.startsWith("https://")) {
|
|
80
|
+
return {
|
|
81
|
+
base: e,
|
|
82
|
+
evi: e.replace('https://', 'wss://') + "/v0/evi",
|
|
83
|
+
tts: e.replace('https://', 'wss://') + "/v0/tts",
|
|
84
|
+
stream: e.replace('https://', 'wss://') + "/v0/stream",
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
throw new Error(`Invalid environment URL: ${e}. Must start with http:// or https://`);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return e;
|
|
91
|
+
}
|
|
92
|
+
}) : undefined;
|
|
93
|
+
options.environment = environment;
|
|
53
94
|
}
|
|
54
|
-
super(
|
|
95
|
+
super(options);
|
|
55
96
|
}
|
|
56
97
|
get expressionMeasurement() {
|
|
57
98
|
var _a;
|