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.
Files changed (149) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +7 -2
  4. package/dist/cjs/api/resources/agent/errors/ConflictError.d.ts +5 -0
  5. package/dist/cjs/api/resources/agent/errors/ConflictError.js +54 -0
  6. package/dist/cjs/api/resources/agent/errors/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/agent/errors/index.js +1 -0
  8. package/dist/cjs/api/resources/agent/resources/chat/client/Client.d.ts +1 -0
  9. package/dist/cjs/api/resources/agent/resources/chat/client/Client.js +5 -0
  10. package/dist/cjs/api/resources/agent/resources/chat/client/requests/AgentChatRequest.d.ts +1 -1
  11. package/dist/cjs/api/resources/agent/resources/chat/client/requests/AgentStreamChatRequest.d.ts +1 -1
  12. package/dist/cjs/api/resources/fhir2Omop/client/Client.d.ts +26 -0
  13. package/dist/cjs/api/resources/fhir2Omop/client/Client.js +26 -0
  14. package/dist/cjs/api/resources/fhir2Omop/client/requests/CreateOmopRequest.d.ts +6 -3
  15. package/dist/cjs/api/resources/fhir2Omop/types/CreateOmopResponse.d.ts +6 -1
  16. package/dist/cjs/api/resources/index.d.ts +1 -0
  17. package/dist/cjs/api/resources/index.js +2 -1
  18. package/dist/cjs/api/resources/voice/client/Client.d.ts +12 -0
  19. package/dist/cjs/api/resources/voice/client/Client.js +16 -0
  20. package/dist/cjs/api/resources/voice/client/index.d.ts +1 -0
  21. package/dist/cjs/api/resources/voice/client/index.js +2 -0
  22. package/dist/cjs/api/resources/voice/errors/BadGatewayError.d.ts +5 -0
  23. package/dist/cjs/api/resources/voice/errors/BadGatewayError.js +54 -0
  24. package/dist/cjs/api/resources/voice/errors/BadRequestError.d.ts +5 -0
  25. package/dist/cjs/api/resources/voice/errors/BadRequestError.js +54 -0
  26. package/dist/cjs/api/resources/voice/errors/ContentTooLargeError.d.ts +5 -0
  27. package/dist/cjs/api/resources/voice/errors/ContentTooLargeError.js +54 -0
  28. package/dist/cjs/api/resources/voice/errors/GatewayTimeoutError.d.ts +5 -0
  29. package/dist/cjs/api/resources/voice/errors/GatewayTimeoutError.js +54 -0
  30. package/dist/cjs/api/resources/voice/errors/PaymentRequiredError.d.ts +5 -0
  31. package/dist/cjs/api/resources/voice/errors/PaymentRequiredError.js +54 -0
  32. package/dist/cjs/api/resources/voice/errors/ServiceUnavailableError.d.ts +5 -0
  33. package/dist/cjs/api/resources/voice/errors/ServiceUnavailableError.js +54 -0
  34. package/dist/cjs/api/resources/voice/errors/UnauthorizedError.d.ts +5 -0
  35. package/dist/cjs/api/resources/voice/errors/UnauthorizedError.js +54 -0
  36. package/dist/cjs/api/resources/voice/errors/index.d.ts +7 -0
  37. package/dist/cjs/api/resources/voice/errors/index.js +23 -0
  38. package/dist/cjs/api/resources/voice/exports.d.ts +3 -0
  39. package/dist/cjs/api/resources/voice/exports.js +22 -0
  40. package/dist/cjs/api/resources/voice/index.d.ts +4 -0
  41. package/dist/cjs/api/resources/voice/index.js +20 -0
  42. package/dist/cjs/api/resources/voice/resources/index.d.ts +2 -0
  43. package/dist/cjs/api/resources/voice/resources/index.js +41 -0
  44. package/dist/cjs/api/resources/voice/resources/voice/client/Client.d.ts +41 -0
  45. package/dist/cjs/api/resources/voice/resources/voice/client/Client.js +146 -0
  46. package/dist/cjs/api/resources/voice/resources/voice/client/index.d.ts +1 -0
  47. package/dist/cjs/api/resources/voice/resources/voice/client/index.js +17 -0
  48. package/dist/cjs/api/resources/voice/resources/voice/client/requests/TranscribeRequest.d.ts +4 -0
  49. package/dist/cjs/api/resources/voice/resources/voice/client/requests/TranscribeRequest.js +3 -0
  50. package/dist/cjs/api/resources/voice/resources/voice/client/requests/index.d.ts +1 -0
  51. package/dist/cjs/api/resources/voice/resources/voice/client/requests/index.js +2 -0
  52. package/dist/cjs/api/resources/voice/resources/voice/exports.d.ts +2 -0
  53. package/dist/cjs/api/resources/voice/resources/voice/exports.js +21 -0
  54. package/dist/cjs/api/resources/voice/resources/voice/index.d.ts +1 -0
  55. package/dist/cjs/api/resources/voice/resources/voice/index.js +17 -0
  56. package/dist/cjs/api/resources/voice/types/TranscribeResponse.d.ts +4 -0
  57. package/dist/cjs/api/resources/voice/types/TranscribeResponse.js +3 -0
  58. package/dist/cjs/api/resources/voice/types/index.d.ts +1 -0
  59. package/dist/cjs/api/resources/voice/types/index.js +17 -0
  60. package/dist/cjs/core/exports.d.ts +1 -0
  61. package/dist/cjs/core/exports.js +1 -0
  62. package/dist/cjs/core/file/exports.d.ts +1 -0
  63. package/dist/cjs/core/file/exports.js +2 -0
  64. package/dist/cjs/core/file/file.d.ts +10 -0
  65. package/dist/cjs/core/file/file.js +222 -0
  66. package/dist/cjs/core/file/index.d.ts +2 -0
  67. package/dist/cjs/core/file/index.js +18 -0
  68. package/dist/cjs/core/file/types.d.ts +66 -0
  69. package/dist/cjs/core/file/types.js +2 -0
  70. package/dist/cjs/core/index.d.ts +1 -0
  71. package/dist/cjs/core/index.js +2 -1
  72. package/dist/cjs/version.d.ts +1 -1
  73. package/dist/cjs/version.js +1 -1
  74. package/dist/esm/BaseClient.mjs +2 -2
  75. package/dist/esm/Client.d.mts +3 -0
  76. package/dist/esm/Client.mjs +5 -0
  77. package/dist/esm/api/resources/agent/errors/ConflictError.d.mts +5 -0
  78. package/dist/esm/api/resources/agent/errors/ConflictError.mjs +17 -0
  79. package/dist/esm/api/resources/agent/errors/index.d.mts +1 -0
  80. package/dist/esm/api/resources/agent/errors/index.mjs +1 -0
  81. package/dist/esm/api/resources/agent/resources/chat/client/Client.d.mts +1 -0
  82. package/dist/esm/api/resources/agent/resources/chat/client/Client.mjs +5 -0
  83. package/dist/esm/api/resources/agent/resources/chat/client/requests/AgentChatRequest.d.mts +1 -1
  84. package/dist/esm/api/resources/agent/resources/chat/client/requests/AgentStreamChatRequest.d.mts +1 -1
  85. package/dist/esm/api/resources/fhir2Omop/client/Client.d.mts +26 -0
  86. package/dist/esm/api/resources/fhir2Omop/client/Client.mjs +26 -0
  87. package/dist/esm/api/resources/fhir2Omop/client/requests/CreateOmopRequest.d.mts +6 -3
  88. package/dist/esm/api/resources/fhir2Omop/types/CreateOmopResponse.d.mts +6 -1
  89. package/dist/esm/api/resources/index.d.mts +1 -0
  90. package/dist/esm/api/resources/index.mjs +1 -0
  91. package/dist/esm/api/resources/voice/client/Client.d.mts +12 -0
  92. package/dist/esm/api/resources/voice/client/Client.mjs +12 -0
  93. package/dist/esm/api/resources/voice/client/index.d.mts +1 -0
  94. package/dist/esm/api/resources/voice/client/index.mjs +1 -0
  95. package/dist/esm/api/resources/voice/errors/BadGatewayError.d.mts +5 -0
  96. package/dist/esm/api/resources/voice/errors/BadGatewayError.mjs +17 -0
  97. package/dist/esm/api/resources/voice/errors/BadRequestError.d.mts +5 -0
  98. package/dist/esm/api/resources/voice/errors/BadRequestError.mjs +17 -0
  99. package/dist/esm/api/resources/voice/errors/ContentTooLargeError.d.mts +5 -0
  100. package/dist/esm/api/resources/voice/errors/ContentTooLargeError.mjs +17 -0
  101. package/dist/esm/api/resources/voice/errors/GatewayTimeoutError.d.mts +5 -0
  102. package/dist/esm/api/resources/voice/errors/GatewayTimeoutError.mjs +17 -0
  103. package/dist/esm/api/resources/voice/errors/PaymentRequiredError.d.mts +5 -0
  104. package/dist/esm/api/resources/voice/errors/PaymentRequiredError.mjs +17 -0
  105. package/dist/esm/api/resources/voice/errors/ServiceUnavailableError.d.mts +5 -0
  106. package/dist/esm/api/resources/voice/errors/ServiceUnavailableError.mjs +17 -0
  107. package/dist/esm/api/resources/voice/errors/UnauthorizedError.d.mts +5 -0
  108. package/dist/esm/api/resources/voice/errors/UnauthorizedError.mjs +17 -0
  109. package/dist/esm/api/resources/voice/errors/index.d.mts +7 -0
  110. package/dist/esm/api/resources/voice/errors/index.mjs +7 -0
  111. package/dist/esm/api/resources/voice/exports.d.mts +3 -0
  112. package/dist/esm/api/resources/voice/exports.mjs +4 -0
  113. package/dist/esm/api/resources/voice/index.d.mts +4 -0
  114. package/dist/esm/api/resources/voice/index.mjs +4 -0
  115. package/dist/esm/api/resources/voice/resources/index.d.mts +2 -0
  116. package/dist/esm/api/resources/voice/resources/index.mjs +2 -0
  117. package/dist/esm/api/resources/voice/resources/voice/client/Client.d.mts +41 -0
  118. package/dist/esm/api/resources/voice/resources/voice/client/Client.mjs +109 -0
  119. package/dist/esm/api/resources/voice/resources/voice/client/index.d.mts +1 -0
  120. package/dist/esm/api/resources/voice/resources/voice/client/index.mjs +1 -0
  121. package/dist/esm/api/resources/voice/resources/voice/client/requests/TranscribeRequest.d.mts +4 -0
  122. package/dist/esm/api/resources/voice/resources/voice/client/requests/TranscribeRequest.mjs +2 -0
  123. package/dist/esm/api/resources/voice/resources/voice/client/requests/index.d.mts +1 -0
  124. package/dist/esm/api/resources/voice/resources/voice/client/requests/index.mjs +1 -0
  125. package/dist/esm/api/resources/voice/resources/voice/exports.d.mts +2 -0
  126. package/dist/esm/api/resources/voice/resources/voice/exports.mjs +3 -0
  127. package/dist/esm/api/resources/voice/resources/voice/index.d.mts +1 -0
  128. package/dist/esm/api/resources/voice/resources/voice/index.mjs +1 -0
  129. package/dist/esm/api/resources/voice/types/TranscribeResponse.d.mts +4 -0
  130. package/dist/esm/api/resources/voice/types/TranscribeResponse.mjs +2 -0
  131. package/dist/esm/api/resources/voice/types/index.d.mts +1 -0
  132. package/dist/esm/api/resources/voice/types/index.mjs +1 -0
  133. package/dist/esm/core/exports.d.mts +1 -0
  134. package/dist/esm/core/exports.mjs +1 -0
  135. package/dist/esm/core/file/exports.d.mts +1 -0
  136. package/dist/esm/core/file/exports.mjs +1 -0
  137. package/dist/esm/core/file/file.d.mts +10 -0
  138. package/dist/esm/core/file/file.mjs +185 -0
  139. package/dist/esm/core/file/index.d.mts +2 -0
  140. package/dist/esm/core/file/index.mjs +2 -0
  141. package/dist/esm/core/file/types.d.mts +66 -0
  142. package/dist/esm/core/file/types.mjs +1 -0
  143. package/dist/esm/core/index.d.mts +1 -0
  144. package/dist/esm/core/index.mjs +1 -0
  145. package/dist/esm/version.d.mts +1 -1
  146. package/dist/esm/version.mjs +1 -1
  147. package/openapi/openapi.json +109 -6
  148. package/package.json +12 -1
  149. 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,5 @@
1
+ import type * as core from "../../../../core/index.mjs";
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export declare class BadGatewayError extends errors.phenomlError {
4
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
5
+ }
@@ -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,5 @@
1
+ import type * as core from "../../../../core/index.mjs";
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export declare class BadRequestError extends errors.phenomlError {
4
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
5
+ }
@@ -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,5 @@
1
+ import type * as core from "../../../../core/index.mjs";
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export declare class ContentTooLargeError extends errors.phenomlError {
4
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
5
+ }
@@ -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,5 @@
1
+ import type * as core from "../../../../core/index.mjs";
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export declare class GatewayTimeoutError extends errors.phenomlError {
4
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
5
+ }
@@ -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,5 @@
1
+ import type * as core from "../../../../core/index.mjs";
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export declare class PaymentRequiredError extends errors.phenomlError {
4
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
5
+ }
@@ -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,5 @@
1
+ import type * as core from "../../../../core/index.mjs";
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export declare class ServiceUnavailableError extends errors.phenomlError {
4
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
5
+ }
@@ -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,5 @@
1
+ import type * as core from "../../../../core/index.mjs";
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ export declare class UnauthorizedError extends errors.phenomlError {
4
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
5
+ }
@@ -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,3 @@
1
+ export { VoiceClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
3
+ export * from "./resources/index.mjs";
@@ -0,0 +1,4 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { VoiceClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
4
+ export * from "./resources/index.mjs";
@@ -0,0 +1,4 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./errors/index.mjs";
3
+ export * from "./resources/index.mjs";
4
+ export * from "./types/index.mjs";
@@ -0,0 +1,4 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./errors/index.mjs";
3
+ export * from "./resources/index.mjs";
4
+ export * from "./types/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./voice/client/requests/index.mjs";
2
+ export * as voice from "./voice/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./voice/client/requests/index.mjs";
2
+ export * as voice from "./voice/index.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,4 @@
1
+ export interface TranscribeRequest {
2
+ /** BCP-47 language tag, repeatable for up to 4 candidate languages. Defaults to `en-US`. */
3
+ language?: string | string[];
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export type { TranscribeRequest } from "./TranscribeRequest.mjs";
@@ -0,0 +1,2 @@
1
+ export { VoiceClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { VoiceClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1,4 @@
1
+ export interface TranscribeResponse {
2
+ /** The full transcript of the audio. */
3
+ transcript: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./TranscribeResponse.mjs";
@@ -0,0 +1 @@
1
+ export * from "./TranscribeResponse.mjs";
@@ -1 +1,2 @@
1
+ export * from "./file/exports.mjs";
1
2
  export * from "./logging/exports.mjs";
@@ -1 +1,2 @@
1
+ export * from "./file/exports.mjs";
1
2
  export * from "./logging/exports.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
+ }>;