hume 0.12.1 → 0.12.2
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 +169 -75
- package/.mock/definition/empathic-voice/configs.yml +10 -4
- package/.mock/definition/tts/__package__.yml +7 -38
- package/api/resources/empathicVoice/client/index.d.ts +1 -0
- package/api/resources/empathicVoice/client/index.js +15 -0
- package/api/resources/empathicVoice/client/requests/BodyCustomLanguageModelSupportsToolUseV0EviCustomLanguageModelSupportsToolUsePost.d.ts +12 -0
- package/api/resources/empathicVoice/client/requests/BodyCustomLanguageModelSupportsToolUseV0EviCustomLanguageModelSupportsToolUsePost.js +5 -0
- package/api/resources/empathicVoice/client/requests/index.d.ts +1 -0
- package/api/resources/empathicVoice/client/requests/index.js +2 -0
- package/api/resources/empathicVoice/errors/UnprocessableEntityError.d.ts +9 -0
- package/{core/form-data-utils/toReadableStream.js → api/resources/empathicVoice/errors/UnprocessableEntityError.js} +16 -14
- package/api/resources/empathicVoice/errors/index.d.ts +1 -0
- package/api/resources/empathicVoice/errors/index.js +1 -0
- package/api/resources/empathicVoice/resources/chatGroups/client/index.d.ts +1 -0
- package/api/resources/empathicVoice/resources/chats/client/index.d.ts +1 -0
- package/api/resources/empathicVoice/resources/configs/client/index.d.ts +1 -0
- package/api/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +5 -1
- package/api/resources/empathicVoice/resources/prompts/client/index.d.ts +1 -0
- package/api/resources/empathicVoice/resources/tools/client/index.d.ts +1 -0
- package/api/resources/empathicVoice/types/LanguageModelType.d.ts +17 -1
- package/api/resources/empathicVoice/types/LanguageModelType.js +16 -0
- package/api/resources/empathicVoice/types/ModelProviderEnum.d.ts +4 -1
- package/api/resources/empathicVoice/types/ModelProviderEnum.js +3 -0
- package/api/resources/empathicVoice/types/ReturnChatEvent.d.ts +12 -17
- package/api/resources/empathicVoice/types/ReturnChatEventRole.d.ts +0 -4
- package/api/resources/empathicVoice/types/ReturnChatEventType.d.ts +22 -18
- package/api/resources/empathicVoice/types/ReturnChatEventType.js +9 -4
- package/api/resources/empathicVoice/types/ReturnConfig.d.ts +21 -17
- package/api/resources/empathicVoice/types/ReturnPrompt.d.ts +2 -2
- package/api/resources/empathicVoice/types/SupportsToolUse.d.ts +7 -0
- package/api/resources/empathicVoice/types/SupportsToolUse.js +5 -0
- package/api/resources/empathicVoice/types/UserMessage.d.ts +8 -1
- package/api/resources/empathicVoice/types/index.d.ts +1 -0
- package/api/resources/empathicVoice/types/index.js +1 -0
- package/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +2 -4
- package/api/resources/expressionMeasurement/resources/batch/client/Client.js +1 -1
- package/api/resources/expressionMeasurement/resources/batch/client/index.d.ts +1 -0
- package/api/resources/tts/client/index.d.ts +1 -0
- package/api/resources/tts/resources/voices/client/index.d.ts +1 -0
- package/api/resources/tts/types/PostedUtterance.d.ts +1 -1
- package/api/resources/tts/types/SnippetAudioChunk.d.ts +0 -16
- package/core/fetcher/BinaryResponse.d.ts +17 -0
- package/core/fetcher/BinaryResponse.js +14 -0
- package/core/fetcher/Fetcher.d.ts +1 -1
- package/core/fetcher/ResponseWithBody.d.ts +4 -0
- package/core/fetcher/ResponseWithBody.js +6 -0
- package/core/fetcher/getFetchFn.js +3 -3
- package/core/fetcher/getResponseBody.js +33 -32
- package/core/fetcher/index.d.ts +1 -0
- package/core/file.d.ts +1 -0
- package/core/file.js +2 -0
- package/core/form-data-utils/FormDataWrapper.d.ts +5 -52
- package/core/form-data-utils/FormDataWrapper.js +104 -124
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/dist/api/resources/empathicVoice/client/index.d.ts +1 -0
- package/dist/api/resources/empathicVoice/client/index.js +15 -0
- package/dist/api/resources/empathicVoice/client/requests/BodyCustomLanguageModelSupportsToolUseV0EviCustomLanguageModelSupportsToolUsePost.d.ts +12 -0
- package/dist/api/resources/empathicVoice/client/requests/BodyCustomLanguageModelSupportsToolUseV0EviCustomLanguageModelSupportsToolUsePost.js +5 -0
- package/dist/api/resources/empathicVoice/client/requests/index.d.ts +1 -0
- package/dist/api/resources/empathicVoice/client/requests/index.js +2 -0
- package/dist/api/resources/empathicVoice/errors/UnprocessableEntityError.d.ts +9 -0
- package/dist/{core/form-data-utils/toReadableStream.js → api/resources/empathicVoice/errors/UnprocessableEntityError.js} +16 -14
- package/dist/api/resources/empathicVoice/errors/index.d.ts +1 -0
- package/dist/api/resources/empathicVoice/errors/index.js +1 -0
- package/dist/api/resources/empathicVoice/resources/chatGroups/client/index.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/chats/client/index.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/configs/client/index.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +5 -1
- package/dist/api/resources/empathicVoice/resources/prompts/client/index.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/tools/client/index.d.ts +1 -0
- package/dist/api/resources/empathicVoice/types/LanguageModelType.d.ts +17 -1
- package/dist/api/resources/empathicVoice/types/LanguageModelType.js +16 -0
- package/dist/api/resources/empathicVoice/types/ModelProviderEnum.d.ts +4 -1
- package/dist/api/resources/empathicVoice/types/ModelProviderEnum.js +3 -0
- package/dist/api/resources/empathicVoice/types/ReturnChatEvent.d.ts +12 -17
- package/dist/api/resources/empathicVoice/types/ReturnChatEventRole.d.ts +0 -4
- package/dist/api/resources/empathicVoice/types/ReturnChatEventType.d.ts +22 -18
- package/dist/api/resources/empathicVoice/types/ReturnChatEventType.js +9 -4
- package/dist/api/resources/empathicVoice/types/ReturnConfig.d.ts +21 -17
- package/dist/api/resources/empathicVoice/types/ReturnPrompt.d.ts +2 -2
- package/dist/api/resources/empathicVoice/types/SupportsToolUse.d.ts +7 -0
- package/dist/api/resources/empathicVoice/types/SupportsToolUse.js +5 -0
- package/dist/api/resources/empathicVoice/types/UserMessage.d.ts +8 -1
- 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/expressionMeasurement/resources/batch/client/Client.d.ts +2 -4
- package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.js +1 -1
- package/dist/api/resources/expressionMeasurement/resources/batch/client/index.d.ts +1 -0
- package/dist/api/resources/tts/client/index.d.ts +1 -0
- package/dist/api/resources/tts/resources/voices/client/index.d.ts +1 -0
- package/dist/api/resources/tts/types/PostedUtterance.d.ts +1 -1
- package/dist/api/resources/tts/types/SnippetAudioChunk.d.ts +0 -16
- package/dist/core/fetcher/BinaryResponse.d.ts +17 -0
- package/dist/core/fetcher/BinaryResponse.js +14 -0
- package/dist/core/fetcher/Fetcher.d.ts +1 -1
- package/dist/core/fetcher/ResponseWithBody.d.ts +4 -0
- package/dist/core/fetcher/ResponseWithBody.js +6 -0
- package/dist/core/fetcher/getFetchFn.js +3 -3
- package/dist/core/fetcher/getResponseBody.js +33 -32
- package/dist/core/fetcher/index.d.ts +1 -0
- package/dist/core/file.d.ts +1 -0
- package/dist/core/file.js +2 -0
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +5 -52
- package/dist/core/form-data-utils/FormDataWrapper.js +104 -124
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/serialization/resources/empathicVoice/client/index.d.ts +1 -0
- package/dist/serialization/resources/empathicVoice/client/index.js +17 -0
- package/dist/serialization/resources/empathicVoice/client/requests/BodyCustomLanguageModelSupportsToolUseV0EviCustomLanguageModelSupportsToolUsePost.d.ts +12 -0
- package/dist/serialization/resources/empathicVoice/client/requests/BodyCustomLanguageModelSupportsToolUseV0EviCustomLanguageModelSupportsToolUsePost.js +43 -0
- package/dist/serialization/resources/empathicVoice/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/empathicVoice/client/requests/index.js +5 -0
- package/dist/serialization/resources/empathicVoice/index.d.ts +1 -0
- package/dist/serialization/resources/empathicVoice/index.js +1 -0
- package/dist/serialization/resources/empathicVoice/types/LanguageModelType.d.ts +1 -1
- package/dist/serialization/resources/empathicVoice/types/LanguageModelType.js +16 -0
- package/dist/serialization/resources/empathicVoice/types/ModelProviderEnum.d.ts +1 -1
- package/dist/serialization/resources/empathicVoice/types/ModelProviderEnum.js +3 -0
- package/dist/serialization/resources/empathicVoice/types/ReturnChatEventType.d.ts +1 -1
- package/dist/serialization/resources/empathicVoice/types/ReturnChatEventType.js +9 -4
- package/dist/serialization/resources/empathicVoice/types/ReturnConfig.d.ts +13 -13
- package/dist/serialization/resources/empathicVoice/types/ReturnConfig.js +13 -13
- package/dist/serialization/resources/empathicVoice/types/ReturnPrompt.d.ts +1 -1
- package/dist/serialization/resources/empathicVoice/types/ReturnPrompt.js +1 -1
- package/dist/serialization/resources/empathicVoice/types/SupportsToolUse.d.ts +13 -0
- package/dist/serialization/resources/empathicVoice/types/SupportsToolUse.js +44 -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/tts/types/SnippetAudioChunk.d.ts +0 -8
- package/dist/serialization/resources/tts/types/SnippetAudioChunk.js +1 -10
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/jest.browser.config.mjs +10 -0
- package/jest.config.mjs +1 -0
- package/package.json +6 -7
- package/reference.md +53 -1
- package/serialization/resources/empathicVoice/client/index.d.ts +1 -0
- package/serialization/resources/empathicVoice/client/index.js +17 -0
- package/serialization/resources/empathicVoice/client/requests/BodyCustomLanguageModelSupportsToolUseV0EviCustomLanguageModelSupportsToolUsePost.d.ts +12 -0
- package/serialization/resources/empathicVoice/client/requests/BodyCustomLanguageModelSupportsToolUseV0EviCustomLanguageModelSupportsToolUsePost.js +43 -0
- package/serialization/resources/empathicVoice/client/requests/index.d.ts +1 -0
- package/serialization/resources/empathicVoice/client/requests/index.js +5 -0
- package/serialization/resources/empathicVoice/index.d.ts +1 -0
- package/serialization/resources/empathicVoice/index.js +1 -0
- package/serialization/resources/empathicVoice/types/LanguageModelType.d.ts +1 -1
- package/serialization/resources/empathicVoice/types/LanguageModelType.js +16 -0
- package/serialization/resources/empathicVoice/types/ModelProviderEnum.d.ts +1 -1
- package/serialization/resources/empathicVoice/types/ModelProviderEnum.js +3 -0
- package/serialization/resources/empathicVoice/types/ReturnChatEventType.d.ts +1 -1
- package/serialization/resources/empathicVoice/types/ReturnChatEventType.js +9 -4
- package/serialization/resources/empathicVoice/types/ReturnConfig.d.ts +13 -13
- package/serialization/resources/empathicVoice/types/ReturnConfig.js +13 -13
- package/serialization/resources/empathicVoice/types/ReturnPrompt.d.ts +1 -1
- package/serialization/resources/empathicVoice/types/ReturnPrompt.js +1 -1
- package/serialization/resources/empathicVoice/types/SupportsToolUse.d.ts +13 -0
- package/serialization/resources/empathicVoice/types/SupportsToolUse.js +44 -0
- package/serialization/resources/empathicVoice/types/index.d.ts +1 -0
- package/serialization/resources/empathicVoice/types/index.js +1 -0
- package/serialization/resources/tts/types/SnippetAudioChunk.d.ts +0 -8
- package/serialization/resources/tts/types/SnippetAudioChunk.js +1 -10
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/core/form-data-utils/toReadableStream.d.ts +0 -1
- package/dist/core/form-data-utils/toReadableStream.d.ts +0 -1
|
@@ -10,45 +10,46 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getResponseBody = getResponseBody;
|
|
13
|
+
const BinaryResponse_1 = require("./BinaryResponse");
|
|
14
|
+
const ResponseWithBody_1 = require("./ResponseWithBody");
|
|
13
15
|
const chooseStreamWrapper_1 = require("./stream-wrappers/chooseStreamWrapper");
|
|
14
16
|
function getResponseBody(response, responseType) {
|
|
15
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
if (
|
|
17
|
-
return
|
|
18
|
+
if (!(0, ResponseWithBody_1.isResponseWithBody)(response)) {
|
|
19
|
+
return undefined;
|
|
18
20
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
switch (responseType) {
|
|
22
|
+
case "binary-response":
|
|
23
|
+
return (0, BinaryResponse_1.getBinaryResponse)(response);
|
|
24
|
+
case "blob":
|
|
25
|
+
return yield response.blob();
|
|
26
|
+
case "arrayBuffer":
|
|
27
|
+
return yield response.arrayBuffer();
|
|
28
|
+
case "sse":
|
|
29
|
+
return response.body;
|
|
30
|
+
case "streaming":
|
|
31
|
+
return (0, chooseStreamWrapper_1.chooseStreamWrapper)(response.body);
|
|
32
|
+
case "text":
|
|
33
|
+
return yield response.text();
|
|
21
34
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
else if (response.body != null && responseType === "text") {
|
|
29
|
-
return yield response.text();
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
const text = yield response.text();
|
|
33
|
-
if (text.length > 0) {
|
|
34
|
-
try {
|
|
35
|
-
let responseBody = JSON.parse(text);
|
|
36
|
-
return responseBody;
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
return {
|
|
40
|
-
ok: false,
|
|
41
|
-
error: {
|
|
42
|
-
reason: "non-json",
|
|
43
|
-
statusCode: response.status,
|
|
44
|
-
rawBody: text,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
}
|
|
35
|
+
// if responseType is "json" or not specified, try to parse as JSON
|
|
36
|
+
const text = yield response.text();
|
|
37
|
+
if (text.length > 0) {
|
|
38
|
+
try {
|
|
39
|
+
let responseBody = JSON.parse(text);
|
|
40
|
+
return responseBody;
|
|
48
41
|
}
|
|
49
|
-
|
|
50
|
-
return
|
|
42
|
+
catch (err) {
|
|
43
|
+
return {
|
|
44
|
+
ok: false,
|
|
45
|
+
error: {
|
|
46
|
+
reason: "non-json",
|
|
47
|
+
statusCode: response.status,
|
|
48
|
+
rawBody: text,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
return undefined;
|
|
53
54
|
});
|
|
54
55
|
}
|
package/core/fetcher/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export { Supplier } from "./Supplier";
|
|
|
6
6
|
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse";
|
|
7
7
|
export type { RawResponse, WithRawResponse } from "./RawResponse";
|
|
8
8
|
export { HttpResponsePromise } from "./HttpResponsePromise";
|
|
9
|
+
export { BinaryResponse } from "./BinaryResponse";
|
package/core/file.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type FileLike = ArrayBuffer | Uint8Array | import("buffer").Buffer | import("buffer").Blob | import("buffer").File | import("stream").Readable | import("stream/web").ReadableStream | globalThis.Blob | globalThis.File | ReadableStream;
|
package/core/file.js
ADDED
|
@@ -1,63 +1,16 @@
|
|
|
1
|
-
export type MaybePromise<T> = Promise<T> | T;
|
|
2
1
|
interface FormDataRequest<Body> {
|
|
3
2
|
body: Body;
|
|
4
3
|
headers: Record<string, string>;
|
|
5
4
|
duplex?: "half";
|
|
6
5
|
}
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
append(key: string, value: unknown): void;
|
|
10
|
-
appendFile(key: string, value: unknown, fileName?: string): Promise<void>;
|
|
11
|
-
getRequest(): MaybePromise<FormDataRequest<unknown>>;
|
|
12
|
-
}
|
|
13
|
-
export declare function newFormData(): Promise<CrossPlatformFormData>;
|
|
14
|
-
export type Node18FormDataFd = {
|
|
15
|
-
append(name: string, value: unknown, fileName?: string): void;
|
|
16
|
-
} | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Form Data Implementation for Node.js 18+
|
|
19
|
-
*/
|
|
20
|
-
export declare class Node18FormData implements CrossPlatformFormData {
|
|
6
|
+
export declare function newFormData(): Promise<FormDataWrapper>;
|
|
7
|
+
export declare class FormDataWrapper {
|
|
21
8
|
private fd;
|
|
22
9
|
setup(): Promise<void>;
|
|
23
|
-
append(key: string, value:
|
|
24
|
-
private getFileName;
|
|
25
|
-
appendFile(key: string, value: unknown, fileName?: string): Promise<void>;
|
|
26
|
-
getRequest(): Promise<FormDataRequest<unknown>>;
|
|
27
|
-
}
|
|
28
|
-
export type Node16FormDataFd = {
|
|
29
|
-
append(name: string, value: unknown, options?: string | {
|
|
30
|
-
header?: string | Headers;
|
|
31
|
-
knownLength?: number;
|
|
32
|
-
filename?: string;
|
|
33
|
-
filepath?: string;
|
|
34
|
-
contentType?: string;
|
|
35
|
-
}): void;
|
|
36
|
-
getHeaders(): Record<string, string>;
|
|
37
|
-
} | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Form Data Implementation for Node.js 16-18
|
|
40
|
-
*/
|
|
41
|
-
export declare class Node16FormData implements CrossPlatformFormData {
|
|
42
|
-
private fd;
|
|
43
|
-
setup(): Promise<void>;
|
|
44
|
-
append(key: string, value: any): void;
|
|
10
|
+
append(key: string, value: unknown): void;
|
|
45
11
|
private getFileName;
|
|
12
|
+
private convertToBlob;
|
|
46
13
|
appendFile(key: string, value: unknown, fileName?: string): Promise<void>;
|
|
47
|
-
getRequest(): FormDataRequest<
|
|
48
|
-
}
|
|
49
|
-
export type WebFormDataFd = {
|
|
50
|
-
append(name: string, value: string | Blob, fileName?: string): void;
|
|
51
|
-
} | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Form Data Implementation for Web
|
|
54
|
-
*/
|
|
55
|
-
export declare class WebFormData implements CrossPlatformFormData {
|
|
56
|
-
protected fd: WebFormDataFd;
|
|
57
|
-
setup(): Promise<void>;
|
|
58
|
-
append(key: string, value: any): void;
|
|
59
|
-
private getFileName;
|
|
60
|
-
appendFile(key: string, value: any, fileName?: string): Promise<void>;
|
|
61
|
-
getRequest(): FormDataRequest<WebFormDataFd>;
|
|
14
|
+
getRequest(): FormDataRequest<FormData>;
|
|
62
15
|
}
|
|
63
16
|
export {};
|
|
@@ -41,51 +41,110 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
41
41
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
45
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
46
|
+
var m = o[Symbol.asyncIterator], i;
|
|
47
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
48
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
49
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
50
|
+
};
|
|
44
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.
|
|
52
|
+
exports.FormDataWrapper = void 0;
|
|
46
53
|
exports.newFormData = newFormData;
|
|
54
|
+
const json_js_1 = require("../../core/json.js");
|
|
47
55
|
const index_js_1 = require("../runtime/index.js");
|
|
48
|
-
const toReadableStream_js_1 = require("./toReadableStream.js");
|
|
49
56
|
function isNamedValue(value) {
|
|
50
57
|
return typeof value === "object" && value != null && "name" in value;
|
|
51
58
|
}
|
|
52
59
|
function isPathedValue(value) {
|
|
53
60
|
return typeof value === "object" && value != null && "path" in value;
|
|
54
61
|
}
|
|
62
|
+
function isStreamLike(value) {
|
|
63
|
+
return typeof value === "object" && value != null && ("read" in value || "pipe" in value);
|
|
64
|
+
}
|
|
65
|
+
function isReadableStream(value) {
|
|
66
|
+
return typeof value === "object" && value != null && "getReader" in value;
|
|
67
|
+
}
|
|
68
|
+
function isBuffer(value) {
|
|
69
|
+
return typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(value);
|
|
70
|
+
}
|
|
71
|
+
function isArrayBufferView(value) {
|
|
72
|
+
return ArrayBuffer.isView(value);
|
|
73
|
+
}
|
|
55
74
|
function getLastPathSegment(pathStr) {
|
|
56
75
|
const lastForwardSlash = pathStr.lastIndexOf("/");
|
|
57
76
|
const lastBackSlash = pathStr.lastIndexOf("\\");
|
|
58
77
|
const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash);
|
|
59
78
|
return lastSlashIndex >= 0 ? pathStr.substring(lastSlashIndex + 1) : pathStr;
|
|
60
79
|
}
|
|
61
|
-
function
|
|
80
|
+
function streamToBuffer(stream) {
|
|
62
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
82
|
+
var _a, stream_1, stream_1_1;
|
|
83
|
+
var _b, e_1, _c, _d;
|
|
84
|
+
if (index_js_1.RUNTIME.type === "node") {
|
|
85
|
+
const { Readable } = yield Promise.resolve().then(() => __importStar(require("stream")));
|
|
86
|
+
if (stream instanceof Readable) {
|
|
87
|
+
const chunks = [];
|
|
88
|
+
try {
|
|
89
|
+
for (_a = true, stream_1 = __asyncValues(stream); stream_1_1 = yield stream_1.next(), _b = stream_1_1.done, !_b; _a = true) {
|
|
90
|
+
_d = stream_1_1.value;
|
|
91
|
+
_a = false;
|
|
92
|
+
const chunk = _d;
|
|
93
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
97
|
+
finally {
|
|
98
|
+
try {
|
|
99
|
+
if (!_a && !_b && (_c = stream_1.return)) yield _c.call(stream_1);
|
|
100
|
+
}
|
|
101
|
+
finally { if (e_1) throw e_1.error; }
|
|
102
|
+
}
|
|
103
|
+
return Buffer.concat(chunks);
|
|
104
|
+
}
|
|
69
105
|
}
|
|
70
|
-
|
|
71
|
-
|
|
106
|
+
if (isReadableStream(stream)) {
|
|
107
|
+
const reader = stream.getReader();
|
|
108
|
+
const chunks = [];
|
|
109
|
+
try {
|
|
110
|
+
while (true) {
|
|
111
|
+
const { done, value } = yield reader.read();
|
|
112
|
+
if (done)
|
|
113
|
+
break;
|
|
114
|
+
chunks.push(value);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
reader.releaseLock();
|
|
119
|
+
}
|
|
120
|
+
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
121
|
+
const result = new Uint8Array(totalLength);
|
|
122
|
+
let offset = 0;
|
|
123
|
+
for (const chunk of chunks) {
|
|
124
|
+
result.set(chunk, offset);
|
|
125
|
+
offset += chunk.length;
|
|
126
|
+
}
|
|
127
|
+
return Buffer.from(result);
|
|
72
128
|
}
|
|
73
|
-
|
|
74
|
-
|
|
129
|
+
throw new Error("Unsupported stream type: " + typeof stream + ". Expected Node.js Readable stream or Web ReadableStream.");
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function newFormData() {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
return new FormDataWrapper();
|
|
75
135
|
});
|
|
76
136
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
137
|
+
class FormDataWrapper {
|
|
138
|
+
constructor() {
|
|
139
|
+
this.fd = new FormData();
|
|
140
|
+
}
|
|
81
141
|
setup() {
|
|
82
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
|
|
143
|
+
// noop
|
|
84
144
|
});
|
|
85
145
|
}
|
|
86
146
|
append(key, value) {
|
|
87
|
-
|
|
88
|
-
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value);
|
|
147
|
+
this.fd.append(key, String(value));
|
|
89
148
|
}
|
|
90
149
|
getFileName(value, filename) {
|
|
91
150
|
if (filename != null) {
|
|
@@ -99,130 +158,51 @@ class Node18FormData {
|
|
|
99
158
|
}
|
|
100
159
|
return undefined;
|
|
101
160
|
}
|
|
102
|
-
|
|
161
|
+
convertToBlob(value) {
|
|
103
162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
|
|
105
|
-
|
|
163
|
+
if (isStreamLike(value) || isReadableStream(value)) {
|
|
164
|
+
const buffer = yield streamToBuffer(value);
|
|
165
|
+
return new Blob([buffer]);
|
|
166
|
+
}
|
|
106
167
|
if (value instanceof Blob) {
|
|
107
|
-
|
|
168
|
+
return value;
|
|
108
169
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
type: undefined,
|
|
112
|
-
name: fileName,
|
|
113
|
-
[Symbol.toStringTag]: "File",
|
|
114
|
-
stream() {
|
|
115
|
-
return value;
|
|
116
|
-
},
|
|
117
|
-
});
|
|
170
|
+
if (isBuffer(value)) {
|
|
171
|
+
return new Blob([value]);
|
|
118
172
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
getRequest() {
|
|
122
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
const encoder = new (yield Promise.resolve().then(() => __importStar(require("form-data-encoder")))).FormDataEncoder(this.fd);
|
|
124
|
-
return {
|
|
125
|
-
body: yield (0, toReadableStream_js_1.toReadableStream)(encoder),
|
|
126
|
-
headers: encoder.headers,
|
|
127
|
-
duplex: "half",
|
|
128
|
-
};
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
exports.Node18FormData = Node18FormData;
|
|
133
|
-
/**
|
|
134
|
-
* Form Data Implementation for Node.js 16-18
|
|
135
|
-
*/
|
|
136
|
-
class Node16FormData {
|
|
137
|
-
setup() {
|
|
138
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
-
this.fd = new (yield Promise.resolve().then(() => __importStar(require("form-data")))).default();
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
append(key, value) {
|
|
143
|
-
var _a;
|
|
144
|
-
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value);
|
|
145
|
-
}
|
|
146
|
-
getFileName(value, filename) {
|
|
147
|
-
if (filename != null) {
|
|
148
|
-
return filename;
|
|
149
|
-
}
|
|
150
|
-
if (isNamedValue(value)) {
|
|
151
|
-
return value.name;
|
|
152
|
-
}
|
|
153
|
-
if (isPathedValue(value) && value.path) {
|
|
154
|
-
return getLastPathSegment(value.path.toString());
|
|
155
|
-
}
|
|
156
|
-
return undefined;
|
|
157
|
-
}
|
|
158
|
-
appendFile(key, value, fileName) {
|
|
159
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
-
var _a, _b;
|
|
161
|
-
fileName = this.getFileName(value, fileName);
|
|
162
|
-
let bufferedValue;
|
|
163
|
-
if (value instanceof Blob) {
|
|
164
|
-
bufferedValue = Buffer.from(yield value.arrayBuffer());
|
|
173
|
+
if (value instanceof ArrayBuffer) {
|
|
174
|
+
return new Blob([value]);
|
|
165
175
|
}
|
|
166
|
-
|
|
167
|
-
|
|
176
|
+
if (isArrayBufferView(value)) {
|
|
177
|
+
return new Blob([value]);
|
|
168
178
|
}
|
|
169
|
-
if (
|
|
170
|
-
|
|
179
|
+
if (typeof value === "string") {
|
|
180
|
+
return new Blob([value]);
|
|
171
181
|
}
|
|
172
|
-
|
|
173
|
-
|
|
182
|
+
if (typeof value === "object" && value !== null) {
|
|
183
|
+
return new Blob([(0, json_js_1.toJson)(value)], { type: "application/json" });
|
|
174
184
|
}
|
|
185
|
+
return new Blob([String(value)]);
|
|
175
186
|
});
|
|
176
187
|
}
|
|
177
|
-
getRequest() {
|
|
178
|
-
return {
|
|
179
|
-
body: this.fd,
|
|
180
|
-
headers: this.fd ? this.fd.getHeaders() : {},
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
exports.Node16FormData = Node16FormData;
|
|
185
|
-
/**
|
|
186
|
-
* Form Data Implementation for Web
|
|
187
|
-
*/
|
|
188
|
-
class WebFormData {
|
|
189
|
-
setup() {
|
|
190
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
-
this.fd = new FormData();
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
append(key, value) {
|
|
195
|
-
var _a;
|
|
196
|
-
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value);
|
|
197
|
-
}
|
|
198
|
-
getFileName(value, filename) {
|
|
199
|
-
if (filename != null) {
|
|
200
|
-
return filename;
|
|
201
|
-
}
|
|
202
|
-
if (isNamedValue(value)) {
|
|
203
|
-
return value.name;
|
|
204
|
-
}
|
|
205
|
-
if (isPathedValue(value) && value.path) {
|
|
206
|
-
return getLastPathSegment(value.path.toString());
|
|
207
|
-
}
|
|
208
|
-
return undefined;
|
|
209
|
-
}
|
|
210
188
|
appendFile(key, value, fileName) {
|
|
211
189
|
return __awaiter(this, void 0, void 0, function* () {
|
|
212
|
-
var _a, _b;
|
|
213
190
|
fileName = this.getFileName(value, fileName);
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
191
|
+
const blob = yield this.convertToBlob(value);
|
|
192
|
+
if (fileName) {
|
|
193
|
+
this.fd.append(key, blob, fileName);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
this.fd.append(key, blob);
|
|
217
197
|
}
|
|
218
|
-
(_b = this.fd) === null || _b === void 0 ? void 0 : _b.append(key, new Blob([value]), fileName);
|
|
219
198
|
});
|
|
220
199
|
}
|
|
221
200
|
getRequest() {
|
|
222
201
|
return {
|
|
223
202
|
body: this.fd,
|
|
224
203
|
headers: {},
|
|
204
|
+
duplex: "half",
|
|
225
205
|
};
|
|
226
206
|
}
|
|
227
207
|
}
|
|
228
|
-
exports.
|
|
208
|
+
exports.FormDataWrapper = FormDataWrapper;
|
package/core/index.d.ts
CHANGED
package/core/index.js
CHANGED
|
@@ -44,6 +44,7 @@ __exportStar(require("./stream"), exports);
|
|
|
44
44
|
__exportStar(require("./utils"), exports);
|
|
45
45
|
__exportStar(require("./pagination"), exports);
|
|
46
46
|
__exportStar(require("./form-data-utils"), exports);
|
|
47
|
+
__exportStar(require("./file"), exports);
|
|
47
48
|
exports.serialization = __importStar(require("./schemas"));
|
|
48
49
|
// This one is manually added
|
|
49
50
|
__exportStar(require("./websocket"), exports);
|
|
@@ -1,2 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* modelResource: "model_resource"
|
|
8
|
+
* }
|
|
9
|
+
*/
|
|
10
|
+
export interface BodyCustomLanguageModelSupportsToolUseV0EviCustomLanguageModelSupportsToolUsePost {
|
|
11
|
+
modelResource: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type BodyCustomLanguageModelSupportsToolUseV0EviCustomLanguageModelSupportsToolUsePost } from "./BodyCustomLanguageModelSupportsToolUseV0EviCustomLanguageModelSupportsToolUsePost";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as errors from "../../../../errors/index";
|
|
5
|
+
import * as Hume from "../../../index";
|
|
6
|
+
import * as core from "../../../../core";
|
|
7
|
+
export declare class UnprocessableEntityError extends errors.HumeError {
|
|
8
|
+
constructor(body: Hume.empathicVoice.HttpValidationError, rawResponse?: core.RawResponse);
|
|
9
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
2
5
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
6
|
if (k2 === undefined) k2 = k;
|
|
4
7
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -32,19 +35,18 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
35
|
return result;
|
|
33
36
|
};
|
|
34
37
|
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
exports.UnprocessableEntityError = void 0;
|
|
40
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
41
|
+
class UnprocessableEntityError extends errors.HumeError {
|
|
42
|
+
constructor(body, rawResponse) {
|
|
43
|
+
super({
|
|
44
|
+
message: "UnprocessableEntityError",
|
|
45
|
+
statusCode: 422,
|
|
46
|
+
body: body,
|
|
47
|
+
rawResponse: rawResponse,
|
|
48
|
+
});
|
|
49
|
+
Object.setPrototypeOf(this, UnprocessableEntityError.prototype);
|
|
50
|
+
}
|
|
50
51
|
}
|
|
52
|
+
exports.UnprocessableEntityError = UnprocessableEntityError;
|
|
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./UnprocessableEntityError"), exports);
|
|
17
18
|
__exportStar(require("./BadRequestError"), exports);
|
package/dist/api/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts
CHANGED
|
@@ -37,7 +37,11 @@ import * as Hume from "../../../../../../index";
|
|
|
37
37
|
* }
|
|
38
38
|
*/
|
|
39
39
|
export interface PostedConfig {
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Specifies the EVI version to use. See our [EVI Version Guide](/docs/speech-to-speech-evi/configuration/evi-version) for differences between versions.
|
|
42
|
+
*
|
|
43
|
+
* **We're officially sunsetting EVI versions 1 and 2 on August 30, 2025**. To keep things running smoothly, be sure to [migrate to EVI 3](/docs/speech-to-speech-evi/configuration/evi-version#migrating-to-evi-3) before then.
|
|
44
|
+
*/
|
|
41
45
|
eviVersion: string;
|
|
42
46
|
/** Name applied to all versions of a particular Config. */
|
|
43
47
|
name: string;
|