phenoml 17.5.0 → 17.7.0
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/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +7 -2
- package/dist/cjs/api/resources/agent/errors/ConflictError.d.ts +5 -0
- package/dist/cjs/api/resources/agent/errors/ConflictError.js +54 -0
- package/dist/cjs/api/resources/agent/errors/index.d.ts +1 -0
- package/dist/cjs/api/resources/agent/errors/index.js +1 -0
- package/dist/cjs/api/resources/agent/resources/chat/client/Client.d.ts +1 -0
- package/dist/cjs/api/resources/agent/resources/chat/client/Client.js +5 -0
- package/dist/cjs/api/resources/agent/resources/chat/client/requests/AgentChatRequest.d.ts +1 -1
- package/dist/cjs/api/resources/agent/resources/chat/client/requests/AgentStreamChatRequest.d.ts +1 -1
- package/dist/cjs/api/resources/fhir2Omop/client/Client.d.ts +26 -0
- package/dist/cjs/api/resources/fhir2Omop/client/Client.js +26 -0
- package/dist/cjs/api/resources/fhir2Omop/client/requests/CreateOmopRequest.d.ts +6 -3
- package/dist/cjs/api/resources/fhir2Omop/types/CreateOmopResponse.d.ts +6 -1
- package/dist/cjs/api/resources/index.d.ts +1 -0
- package/dist/cjs/api/resources/index.js +2 -1
- package/dist/cjs/api/resources/voice/client/Client.d.ts +12 -0
- package/dist/cjs/api/resources/voice/client/Client.js +16 -0
- package/dist/cjs/api/resources/voice/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/voice/client/index.js +2 -0
- package/dist/cjs/api/resources/voice/errors/BadGatewayError.d.ts +5 -0
- package/dist/cjs/api/resources/voice/errors/BadGatewayError.js +54 -0
- package/dist/cjs/api/resources/voice/errors/BadRequestError.d.ts +5 -0
- package/dist/cjs/api/resources/voice/errors/BadRequestError.js +54 -0
- package/dist/cjs/api/resources/voice/errors/ContentTooLargeError.d.ts +5 -0
- package/dist/cjs/api/resources/voice/errors/ContentTooLargeError.js +54 -0
- package/dist/cjs/api/resources/voice/errors/GatewayTimeoutError.d.ts +5 -0
- package/dist/cjs/api/resources/voice/errors/GatewayTimeoutError.js +54 -0
- package/dist/cjs/api/resources/voice/errors/PaymentRequiredError.d.ts +5 -0
- package/dist/cjs/api/resources/voice/errors/PaymentRequiredError.js +54 -0
- package/dist/cjs/api/resources/voice/errors/ServiceUnavailableError.d.ts +5 -0
- package/dist/cjs/api/resources/voice/errors/ServiceUnavailableError.js +54 -0
- package/dist/cjs/api/resources/voice/errors/UnauthorizedError.d.ts +5 -0
- package/dist/cjs/api/resources/voice/errors/UnauthorizedError.js +54 -0
- package/dist/cjs/api/resources/voice/errors/index.d.ts +7 -0
- package/dist/cjs/api/resources/voice/errors/index.js +23 -0
- package/dist/cjs/api/resources/voice/exports.d.ts +3 -0
- package/dist/cjs/api/resources/voice/exports.js +22 -0
- package/dist/cjs/api/resources/voice/index.d.ts +4 -0
- package/dist/cjs/api/resources/voice/index.js +20 -0
- package/dist/cjs/api/resources/voice/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/voice/resources/index.js +41 -0
- package/dist/cjs/api/resources/voice/resources/voice/client/Client.d.ts +41 -0
- package/dist/cjs/api/resources/voice/resources/voice/client/Client.js +146 -0
- package/dist/cjs/api/resources/voice/resources/voice/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/voice/resources/voice/client/index.js +17 -0
- package/dist/cjs/api/resources/voice/resources/voice/client/requests/TranscribeRequest.d.ts +4 -0
- package/dist/cjs/api/resources/voice/resources/voice/client/requests/TranscribeRequest.js +3 -0
- package/dist/cjs/api/resources/voice/resources/voice/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/voice/resources/voice/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/voice/resources/voice/exports.d.ts +2 -0
- package/dist/cjs/api/resources/voice/resources/voice/exports.js +21 -0
- package/dist/cjs/api/resources/voice/resources/voice/index.d.ts +1 -0
- package/dist/cjs/api/resources/voice/resources/voice/index.js +17 -0
- package/dist/cjs/api/resources/voice/types/TranscribeResponse.d.ts +4 -0
- package/dist/cjs/api/resources/voice/types/TranscribeResponse.js +3 -0
- package/dist/cjs/api/resources/voice/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/voice/types/index.js +17 -0
- package/dist/cjs/core/exports.d.ts +1 -0
- package/dist/cjs/core/exports.js +1 -0
- package/dist/cjs/core/file/exports.d.ts +1 -0
- package/dist/cjs/core/file/exports.js +2 -0
- package/dist/cjs/core/file/file.d.ts +10 -0
- package/dist/cjs/core/file/file.js +222 -0
- package/dist/cjs/core/file/index.d.ts +2 -0
- package/dist/cjs/core/file/index.js +18 -0
- package/dist/cjs/core/file/types.d.ts +66 -0
- package/dist/cjs/core/file/types.js +2 -0
- package/dist/cjs/core/index.d.ts +1 -0
- package/dist/cjs/core/index.js +2 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +5 -0
- package/dist/esm/api/resources/agent/errors/ConflictError.d.mts +5 -0
- package/dist/esm/api/resources/agent/errors/ConflictError.mjs +17 -0
- package/dist/esm/api/resources/agent/errors/index.d.mts +1 -0
- package/dist/esm/api/resources/agent/errors/index.mjs +1 -0
- package/dist/esm/api/resources/agent/resources/chat/client/Client.d.mts +1 -0
- package/dist/esm/api/resources/agent/resources/chat/client/Client.mjs +5 -0
- package/dist/esm/api/resources/agent/resources/chat/client/requests/AgentChatRequest.d.mts +1 -1
- package/dist/esm/api/resources/agent/resources/chat/client/requests/AgentStreamChatRequest.d.mts +1 -1
- package/dist/esm/api/resources/fhir2Omop/client/Client.d.mts +26 -0
- package/dist/esm/api/resources/fhir2Omop/client/Client.mjs +26 -0
- package/dist/esm/api/resources/fhir2Omop/client/requests/CreateOmopRequest.d.mts +6 -3
- package/dist/esm/api/resources/fhir2Omop/types/CreateOmopResponse.d.mts +6 -1
- package/dist/esm/api/resources/index.d.mts +1 -0
- package/dist/esm/api/resources/index.mjs +1 -0
- package/dist/esm/api/resources/voice/client/Client.d.mts +12 -0
- package/dist/esm/api/resources/voice/client/Client.mjs +12 -0
- package/dist/esm/api/resources/voice/client/index.d.mts +1 -0
- package/dist/esm/api/resources/voice/client/index.mjs +1 -0
- package/dist/esm/api/resources/voice/errors/BadGatewayError.d.mts +5 -0
- package/dist/esm/api/resources/voice/errors/BadGatewayError.mjs +17 -0
- package/dist/esm/api/resources/voice/errors/BadRequestError.d.mts +5 -0
- package/dist/esm/api/resources/voice/errors/BadRequestError.mjs +17 -0
- package/dist/esm/api/resources/voice/errors/ContentTooLargeError.d.mts +5 -0
- package/dist/esm/api/resources/voice/errors/ContentTooLargeError.mjs +17 -0
- package/dist/esm/api/resources/voice/errors/GatewayTimeoutError.d.mts +5 -0
- package/dist/esm/api/resources/voice/errors/GatewayTimeoutError.mjs +17 -0
- package/dist/esm/api/resources/voice/errors/PaymentRequiredError.d.mts +5 -0
- package/dist/esm/api/resources/voice/errors/PaymentRequiredError.mjs +17 -0
- package/dist/esm/api/resources/voice/errors/ServiceUnavailableError.d.mts +5 -0
- package/dist/esm/api/resources/voice/errors/ServiceUnavailableError.mjs +17 -0
- package/dist/esm/api/resources/voice/errors/UnauthorizedError.d.mts +5 -0
- package/dist/esm/api/resources/voice/errors/UnauthorizedError.mjs +17 -0
- package/dist/esm/api/resources/voice/errors/index.d.mts +7 -0
- package/dist/esm/api/resources/voice/errors/index.mjs +7 -0
- package/dist/esm/api/resources/voice/exports.d.mts +3 -0
- package/dist/esm/api/resources/voice/exports.mjs +4 -0
- package/dist/esm/api/resources/voice/index.d.mts +4 -0
- package/dist/esm/api/resources/voice/index.mjs +4 -0
- package/dist/esm/api/resources/voice/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/voice/resources/index.mjs +2 -0
- package/dist/esm/api/resources/voice/resources/voice/client/Client.d.mts +41 -0
- package/dist/esm/api/resources/voice/resources/voice/client/Client.mjs +109 -0
- package/dist/esm/api/resources/voice/resources/voice/client/index.d.mts +1 -0
- package/dist/esm/api/resources/voice/resources/voice/client/index.mjs +1 -0
- package/dist/esm/api/resources/voice/resources/voice/client/requests/TranscribeRequest.d.mts +4 -0
- package/dist/esm/api/resources/voice/resources/voice/client/requests/TranscribeRequest.mjs +2 -0
- package/dist/esm/api/resources/voice/resources/voice/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/voice/resources/voice/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/voice/resources/voice/exports.d.mts +2 -0
- package/dist/esm/api/resources/voice/resources/voice/exports.mjs +3 -0
- package/dist/esm/api/resources/voice/resources/voice/index.d.mts +1 -0
- package/dist/esm/api/resources/voice/resources/voice/index.mjs +1 -0
- package/dist/esm/api/resources/voice/types/TranscribeResponse.d.mts +4 -0
- package/dist/esm/api/resources/voice/types/TranscribeResponse.mjs +2 -0
- package/dist/esm/api/resources/voice/types/index.d.mts +1 -0
- package/dist/esm/api/resources/voice/types/index.mjs +1 -0
- package/dist/esm/core/exports.d.mts +1 -0
- package/dist/esm/core/exports.mjs +1 -0
- package/dist/esm/core/file/exports.d.mts +1 -0
- package/dist/esm/core/file/exports.mjs +1 -0
- package/dist/esm/core/file/file.d.mts +10 -0
- package/dist/esm/core/file/file.mjs +185 -0
- package/dist/esm/core/file/index.d.mts +2 -0
- package/dist/esm/core/file/index.mjs +2 -0
- package/dist/esm/core/file/types.d.mts +66 -0
- package/dist/esm/core/file/types.mjs +1 -0
- package/dist/esm/core/index.d.mts +1 -0
- package/dist/esm/core/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/openapi/openapi.json +109 -6
- package/package.json +12 -1
- package/reference.md +27 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
|
+
import { VoiceClient as VoiceClient_ } from "../resources/voice/client/Client.mjs";
|
|
4
|
+
export class VoiceClient {
|
|
5
|
+
constructor(options = {}) {
|
|
6
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
7
|
+
}
|
|
8
|
+
get voice() {
|
|
9
|
+
var _a;
|
|
10
|
+
return ((_a = this._voice) !== null && _a !== void 0 ? _a : (this._voice = new VoiceClient_(this._options)));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
3
|
+
export class BadGatewayError extends errors.phenomlError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "BadGatewayError",
|
|
7
|
+
statusCode: 502,
|
|
8
|
+
body: body,
|
|
9
|
+
rawResponse: rawResponse,
|
|
10
|
+
});
|
|
11
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
12
|
+
if (Error.captureStackTrace) {
|
|
13
|
+
Error.captureStackTrace(this, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
this.name = this.constructor.name;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
3
|
+
export class BadRequestError extends errors.phenomlError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "BadRequestError",
|
|
7
|
+
statusCode: 400,
|
|
8
|
+
body: body,
|
|
9
|
+
rawResponse: rawResponse,
|
|
10
|
+
});
|
|
11
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
12
|
+
if (Error.captureStackTrace) {
|
|
13
|
+
Error.captureStackTrace(this, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
this.name = this.constructor.name;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
3
|
+
export class ContentTooLargeError extends errors.phenomlError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "ContentTooLargeError",
|
|
7
|
+
statusCode: 413,
|
|
8
|
+
body: body,
|
|
9
|
+
rawResponse: rawResponse,
|
|
10
|
+
});
|
|
11
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
12
|
+
if (Error.captureStackTrace) {
|
|
13
|
+
Error.captureStackTrace(this, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
this.name = this.constructor.name;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
3
|
+
export class GatewayTimeoutError extends errors.phenomlError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "GatewayTimeoutError",
|
|
7
|
+
statusCode: 504,
|
|
8
|
+
body: body,
|
|
9
|
+
rawResponse: rawResponse,
|
|
10
|
+
});
|
|
11
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
12
|
+
if (Error.captureStackTrace) {
|
|
13
|
+
Error.captureStackTrace(this, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
this.name = this.constructor.name;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
3
|
+
export class PaymentRequiredError extends errors.phenomlError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "PaymentRequiredError",
|
|
7
|
+
statusCode: 402,
|
|
8
|
+
body: body,
|
|
9
|
+
rawResponse: rawResponse,
|
|
10
|
+
});
|
|
11
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
12
|
+
if (Error.captureStackTrace) {
|
|
13
|
+
Error.captureStackTrace(this, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
this.name = this.constructor.name;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
3
|
+
export class ServiceUnavailableError extends errors.phenomlError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "ServiceUnavailableError",
|
|
7
|
+
statusCode: 503,
|
|
8
|
+
body: body,
|
|
9
|
+
rawResponse: rawResponse,
|
|
10
|
+
});
|
|
11
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
12
|
+
if (Error.captureStackTrace) {
|
|
13
|
+
Error.captureStackTrace(this, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
this.name = this.constructor.name;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
3
|
+
export class UnauthorizedError extends errors.phenomlError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "UnauthorizedError",
|
|
7
|
+
statusCode: 401,
|
|
8
|
+
body: body,
|
|
9
|
+
rawResponse: rawResponse,
|
|
10
|
+
});
|
|
11
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
12
|
+
if (Error.captureStackTrace) {
|
|
13
|
+
Error.captureStackTrace(this, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
this.name = this.constructor.name;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./BadGatewayError.mjs";
|
|
2
|
+
export * from "./BadRequestError.mjs";
|
|
3
|
+
export * from "./ContentTooLargeError.mjs";
|
|
4
|
+
export * from "./GatewayTimeoutError.mjs";
|
|
5
|
+
export * from "./PaymentRequiredError.mjs";
|
|
6
|
+
export * from "./ServiceUnavailableError.mjs";
|
|
7
|
+
export * from "./UnauthorizedError.mjs";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./BadGatewayError.mjs";
|
|
2
|
+
export * from "./BadRequestError.mjs";
|
|
3
|
+
export * from "./ContentTooLargeError.mjs";
|
|
4
|
+
export * from "./GatewayTimeoutError.mjs";
|
|
5
|
+
export * from "./PaymentRequiredError.mjs";
|
|
6
|
+
export * from "./ServiceUnavailableError.mjs";
|
|
7
|
+
export * from "./UnauthorizedError.mjs";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
3
|
+
import * as core from "../../../../../../core/index.mjs";
|
|
4
|
+
import * as phenoml from "../../../../../index.mjs";
|
|
5
|
+
export declare namespace VoiceClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Speech-to-text transcription of audio recordings.
|
|
12
|
+
*/
|
|
13
|
+
export declare class VoiceClient {
|
|
14
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<VoiceClient.Options>;
|
|
15
|
+
constructor(options?: VoiceClient.Options);
|
|
16
|
+
/**
|
|
17
|
+
* Transcribes an uploaded audio recording and returns the transcript.
|
|
18
|
+
* Send the raw audio bytes as the request body; the audio format is
|
|
19
|
+
* detected automatically (WAV, FLAC, MP3, OGG/WebM Opus).
|
|
20
|
+
*
|
|
21
|
+
* Supports up to ~5 minutes of audio per request. This limit is on audio
|
|
22
|
+
* duration regardless of file size or format, so a compressed recording
|
|
23
|
+
* within the size limit can still be rejected for being too long. Pair the
|
|
24
|
+
* transcript with a downstream text step (e.g. `POST /lang2fhir/create`)
|
|
25
|
+
* to turn it into a FHIR resource.
|
|
26
|
+
*
|
|
27
|
+
* @param {core.file.Uploadable} uploadable
|
|
28
|
+
* @param {phenoml.voice.TranscribeRequest} request
|
|
29
|
+
* @param {VoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
30
|
+
*
|
|
31
|
+
* @throws {@link phenoml.voice.BadRequestError}
|
|
32
|
+
* @throws {@link phenoml.voice.UnauthorizedError}
|
|
33
|
+
* @throws {@link phenoml.voice.PaymentRequiredError}
|
|
34
|
+
* @throws {@link phenoml.voice.ContentTooLargeError}
|
|
35
|
+
* @throws {@link phenoml.voice.BadGatewayError}
|
|
36
|
+
* @throws {@link phenoml.voice.ServiceUnavailableError}
|
|
37
|
+
* @throws {@link phenoml.voice.GatewayTimeoutError}
|
|
38
|
+
*/
|
|
39
|
+
transcribe(uploadable: core.file.Uploadable, request: phenoml.voice.TranscribeRequest, requestOptions?: VoiceClient.RequestOptions): core.HttpResponsePromise<phenoml.voice.TranscribeResponse>;
|
|
40
|
+
private __transcribe;
|
|
41
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../../../core/headers.mjs";
|
|
13
|
+
import * as core from "../../../../../../core/index.mjs";
|
|
14
|
+
import * as environments from "../../../../../../environments.mjs";
|
|
15
|
+
import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
|
+
import * as errors from "../../../../../../errors/index.mjs";
|
|
17
|
+
import * as phenoml from "../../../../../index.mjs";
|
|
18
|
+
/**
|
|
19
|
+
* Speech-to-text transcription of audio recordings.
|
|
20
|
+
*/
|
|
21
|
+
export class VoiceClient {
|
|
22
|
+
constructor(options = {}) {
|
|
23
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Transcribes an uploaded audio recording and returns the transcript.
|
|
27
|
+
* Send the raw audio bytes as the request body; the audio format is
|
|
28
|
+
* detected automatically (WAV, FLAC, MP3, OGG/WebM Opus).
|
|
29
|
+
*
|
|
30
|
+
* Supports up to ~5 minutes of audio per request. This limit is on audio
|
|
31
|
+
* duration regardless of file size or format, so a compressed recording
|
|
32
|
+
* within the size limit can still be rejected for being too long. Pair the
|
|
33
|
+
* transcript with a downstream text step (e.g. `POST /lang2fhir/create`)
|
|
34
|
+
* to turn it into a FHIR resource.
|
|
35
|
+
*
|
|
36
|
+
* @param {core.file.Uploadable} uploadable
|
|
37
|
+
* @param {phenoml.voice.TranscribeRequest} request
|
|
38
|
+
* @param {VoiceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
39
|
+
*
|
|
40
|
+
* @throws {@link phenoml.voice.BadRequestError}
|
|
41
|
+
* @throws {@link phenoml.voice.UnauthorizedError}
|
|
42
|
+
* @throws {@link phenoml.voice.PaymentRequiredError}
|
|
43
|
+
* @throws {@link phenoml.voice.ContentTooLargeError}
|
|
44
|
+
* @throws {@link phenoml.voice.BadGatewayError}
|
|
45
|
+
* @throws {@link phenoml.voice.ServiceUnavailableError}
|
|
46
|
+
* @throws {@link phenoml.voice.GatewayTimeoutError}
|
|
47
|
+
*/
|
|
48
|
+
transcribe(uploadable, request, requestOptions) {
|
|
49
|
+
return core.HttpResponsePromise.fromPromise(this.__transcribe(uploadable, request, requestOptions));
|
|
50
|
+
}
|
|
51
|
+
__transcribe(uploadable, request, requestOptions) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
54
|
+
const _queryParams = {
|
|
55
|
+
language: request.language,
|
|
56
|
+
};
|
|
57
|
+
const _binaryUploadRequest = yield core.file.toBinaryUploadRequest(uploadable);
|
|
58
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
59
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, _binaryUploadRequest.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
60
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
61
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, "transcribe"),
|
|
62
|
+
method: "POST",
|
|
63
|
+
headers: _headers,
|
|
64
|
+
contentType: "application/octet-stream",
|
|
65
|
+
queryString: core.url
|
|
66
|
+
.queryBuilder()
|
|
67
|
+
.addMany(_queryParams)
|
|
68
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
69
|
+
.build(),
|
|
70
|
+
requestType: "bytes",
|
|
71
|
+
duplex: "half",
|
|
72
|
+
body: _binaryUploadRequest.body,
|
|
73
|
+
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
74
|
+
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
75
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
76
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
77
|
+
logging: this._options.logging,
|
|
78
|
+
});
|
|
79
|
+
if (_response.ok) {
|
|
80
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
81
|
+
}
|
|
82
|
+
if (_response.error.reason === "status-code") {
|
|
83
|
+
switch (_response.error.statusCode) {
|
|
84
|
+
case 400:
|
|
85
|
+
throw new phenoml.voice.BadRequestError(_response.error.body, _response.rawResponse);
|
|
86
|
+
case 401:
|
|
87
|
+
throw new phenoml.voice.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
88
|
+
case 402:
|
|
89
|
+
throw new phenoml.voice.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
90
|
+
case 413:
|
|
91
|
+
throw new phenoml.voice.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
92
|
+
case 502:
|
|
93
|
+
throw new phenoml.voice.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
94
|
+
case 503:
|
|
95
|
+
throw new phenoml.voice.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
96
|
+
case 504:
|
|
97
|
+
throw new phenoml.voice.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
98
|
+
default:
|
|
99
|
+
throw new errors.phenomlError({
|
|
100
|
+
statusCode: _response.error.statusCode,
|
|
101
|
+
body: _response.error.body,
|
|
102
|
+
rawResponse: _response.rawResponse,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/transcribe");
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { TranscribeRequest } from "./TranscribeRequest.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TranscribeResponse.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TranscribeResponse.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { Uploadable } from "./types.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Uploadable } from "./types.mjs";
|
|
2
|
+
export declare function toBinaryUploadRequest(file: Uploadable): Promise<{
|
|
3
|
+
body: Uploadable.FileLike;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function toMultipartDataPart(file: Uploadable): Promise<{
|
|
7
|
+
data: Uploadable.FileLike;
|
|
8
|
+
filename?: string;
|
|
9
|
+
contentType?: string;
|
|
10
|
+
}>;
|