hume 0.11.1 → 0.11.3

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 (203) hide show
  1. package/.mock/definition/empathic-voice/__package__.yml +24 -0
  2. package/.mock/definition/empathic-voice/configs.yml +2 -0
  3. package/.mock/definition/tts/__package__.yml +28 -0
  4. package/.mock/fern.config.json +1 -1
  5. package/Client.d.ts +11 -7
  6. package/Client.js +54 -6
  7. package/api/resources/empathicVoice/errors/BadRequestError.d.ts +2 -1
  8. package/api/resources/empathicVoice/errors/BadRequestError.js +2 -1
  9. package/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +7 -3
  10. package/api/resources/empathicVoice/resources/chatGroups/client/Client.js +79 -52
  11. package/api/resources/empathicVoice/resources/chats/client/Client.d.ts +5 -2
  12. package/api/resources/empathicVoice/resources/chats/client/Client.js +59 -39
  13. package/api/resources/empathicVoice/resources/configs/client/Client.d.ts +17 -8
  14. package/api/resources/empathicVoice/resources/configs/client/Client.js +144 -83
  15. package/api/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +1 -0
  16. package/api/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +1 -0
  17. package/api/resources/empathicVoice/resources/customVoices/client/Client.d.ts +13 -6
  18. package/api/resources/empathicVoice/resources/customVoices/client/Client.js +95 -53
  19. package/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +19 -9
  20. package/api/resources/empathicVoice/resources/prompts/client/Client.js +143 -81
  21. package/api/resources/empathicVoice/resources/tools/client/Client.d.ts +17 -8
  22. package/api/resources/empathicVoice/resources/tools/client/Client.js +144 -83
  23. package/api/resources/empathicVoice/types/PostedNudgeSpec.d.ts +12 -0
  24. package/api/resources/empathicVoice/types/PostedNudgeSpec.js +5 -0
  25. package/api/resources/empathicVoice/types/ReturnConfig.d.ts +1 -0
  26. package/api/resources/empathicVoice/types/ReturnNudgeSpec.d.ts +12 -0
  27. package/api/resources/empathicVoice/types/ReturnNudgeSpec.js +5 -0
  28. package/api/resources/empathicVoice/types/WebhookEventChatStatus.d.ts +2 -1
  29. package/api/resources/empathicVoice/types/WebhookEventChatStatus.js +1 -0
  30. package/api/resources/empathicVoice/types/index.d.ts +2 -0
  31. package/api/resources/empathicVoice/types/index.js +2 -0
  32. package/api/resources/expressionMeasurement/client/Client.d.ts +2 -0
  33. package/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +15 -7
  34. package/api/resources/expressionMeasurement/resources/batch/client/Client.js +96 -52
  35. package/api/resources/tts/client/Client.d.ts +27 -19
  36. package/api/resources/tts/client/Client.js +89 -50
  37. package/api/resources/tts/client/index.d.ts +1 -1
  38. package/api/resources/tts/client/index.js +15 -0
  39. package/api/resources/tts/client/requests/SynthesizeJsonRequest.d.ts +36 -0
  40. package/api/resources/tts/client/requests/SynthesizeJsonRequest.js +5 -0
  41. package/api/resources/tts/client/requests/index.d.ts +1 -0
  42. package/api/resources/tts/client/requests/index.js +2 -0
  43. package/api/resources/tts/errors/BadRequestError.d.ts +2 -1
  44. package/api/resources/tts/errors/BadRequestError.js +2 -1
  45. package/api/resources/tts/errors/UnprocessableEntityError.d.ts +2 -1
  46. package/api/resources/tts/errors/UnprocessableEntityError.js +2 -1
  47. package/api/resources/tts/resources/voices/client/Client.d.ts +7 -3
  48. package/api/resources/tts/resources/voices/client/Client.js +49 -29
  49. package/api/resources/tts/types/Snippet.d.ts +2 -0
  50. package/api/resources/tts/types/SnippetAudioChunk.d.ts +2 -0
  51. package/core/fetcher/APIResponse.d.ts +10 -0
  52. package/core/fetcher/Fetcher.d.ts +2 -1
  53. package/core/fetcher/Fetcher.js +29 -9
  54. package/core/fetcher/Headers.d.ts +2 -0
  55. package/core/fetcher/Headers.js +84 -0
  56. package/core/fetcher/HttpResponsePromise.d.ts +58 -0
  57. package/core/fetcher/HttpResponsePromise.js +103 -0
  58. package/core/fetcher/RawResponse.d.ts +29 -0
  59. package/core/fetcher/RawResponse.js +44 -0
  60. package/core/fetcher/index.d.ts +3 -0
  61. package/core/fetcher/index.js +7 -1
  62. package/core/form-data-utils/FormDataWrapper.d.ts +3 -0
  63. package/core/form-data-utils/FormDataWrapper.js +53 -13
  64. package/core/form-data-utils/toReadableStream.d.ts +1 -0
  65. package/core/form-data-utils/toReadableStream.js +50 -0
  66. package/core/headers.d.ts +3 -0
  67. package/core/headers.js +29 -0
  68. package/core/index.d.ts +4 -4
  69. package/core/index.js +5 -4
  70. package/core/pagination/Page.d.ts +5 -2
  71. package/core/pagination/Page.js +5 -2
  72. package/core/pagination/Pageable.d.ts +2 -0
  73. package/core/runtime/runtime.js +0 -1
  74. package/dist/Client.d.ts +11 -7
  75. package/dist/Client.js +54 -6
  76. package/dist/api/resources/empathicVoice/errors/BadRequestError.d.ts +2 -1
  77. package/dist/api/resources/empathicVoice/errors/BadRequestError.js +2 -1
  78. package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +7 -3
  79. package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.js +79 -52
  80. package/dist/api/resources/empathicVoice/resources/chats/client/Client.d.ts +5 -2
  81. package/dist/api/resources/empathicVoice/resources/chats/client/Client.js +59 -39
  82. package/dist/api/resources/empathicVoice/resources/configs/client/Client.d.ts +17 -8
  83. package/dist/api/resources/empathicVoice/resources/configs/client/Client.js +144 -83
  84. package/dist/api/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +1 -0
  85. package/dist/api/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +1 -0
  86. package/dist/api/resources/empathicVoice/resources/customVoices/client/Client.d.ts +13 -6
  87. package/dist/api/resources/empathicVoice/resources/customVoices/client/Client.js +95 -53
  88. package/dist/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +19 -9
  89. package/dist/api/resources/empathicVoice/resources/prompts/client/Client.js +143 -81
  90. package/dist/api/resources/empathicVoice/resources/tools/client/Client.d.ts +17 -8
  91. package/dist/api/resources/empathicVoice/resources/tools/client/Client.js +144 -83
  92. package/dist/api/resources/empathicVoice/types/PostedNudgeSpec.d.ts +12 -0
  93. package/dist/api/resources/empathicVoice/types/PostedNudgeSpec.js +5 -0
  94. package/dist/api/resources/empathicVoice/types/ReturnConfig.d.ts +1 -0
  95. package/dist/api/resources/empathicVoice/types/ReturnNudgeSpec.d.ts +12 -0
  96. package/dist/api/resources/empathicVoice/types/ReturnNudgeSpec.js +5 -0
  97. package/dist/api/resources/empathicVoice/types/WebhookEventChatStatus.d.ts +2 -1
  98. package/dist/api/resources/empathicVoice/types/WebhookEventChatStatus.js +1 -0
  99. package/dist/api/resources/empathicVoice/types/index.d.ts +2 -0
  100. package/dist/api/resources/empathicVoice/types/index.js +2 -0
  101. package/dist/api/resources/expressionMeasurement/client/Client.d.ts +2 -0
  102. package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +15 -7
  103. package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.js +96 -52
  104. package/dist/api/resources/tts/client/Client.d.ts +27 -19
  105. package/dist/api/resources/tts/client/Client.js +89 -50
  106. package/dist/api/resources/tts/client/index.d.ts +1 -1
  107. package/dist/api/resources/tts/client/index.js +15 -0
  108. package/dist/api/resources/tts/client/requests/SynthesizeJsonRequest.d.ts +36 -0
  109. package/dist/api/resources/tts/client/requests/SynthesizeJsonRequest.js +5 -0
  110. package/dist/api/resources/tts/client/requests/index.d.ts +1 -0
  111. package/dist/api/resources/tts/client/requests/index.js +2 -0
  112. package/dist/api/resources/tts/errors/BadRequestError.d.ts +2 -1
  113. package/dist/api/resources/tts/errors/BadRequestError.js +2 -1
  114. package/dist/api/resources/tts/errors/UnprocessableEntityError.d.ts +2 -1
  115. package/dist/api/resources/tts/errors/UnprocessableEntityError.js +2 -1
  116. package/dist/api/resources/tts/resources/voices/client/Client.d.ts +7 -3
  117. package/dist/api/resources/tts/resources/voices/client/Client.js +49 -29
  118. package/dist/api/resources/tts/types/Snippet.d.ts +2 -0
  119. package/dist/api/resources/tts/types/SnippetAudioChunk.d.ts +2 -0
  120. package/dist/core/fetcher/APIResponse.d.ts +10 -0
  121. package/dist/core/fetcher/Fetcher.d.ts +2 -1
  122. package/dist/core/fetcher/Fetcher.js +29 -9
  123. package/dist/core/fetcher/Headers.d.ts +2 -0
  124. package/dist/core/fetcher/Headers.js +84 -0
  125. package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
  126. package/dist/core/fetcher/HttpResponsePromise.js +103 -0
  127. package/dist/core/fetcher/RawResponse.d.ts +29 -0
  128. package/dist/core/fetcher/RawResponse.js +44 -0
  129. package/dist/core/fetcher/index.d.ts +3 -0
  130. package/dist/core/fetcher/index.js +7 -1
  131. package/dist/core/form-data-utils/FormDataWrapper.d.ts +3 -0
  132. package/dist/core/form-data-utils/FormDataWrapper.js +53 -13
  133. package/dist/core/form-data-utils/toReadableStream.d.ts +1 -0
  134. package/dist/core/form-data-utils/toReadableStream.js +50 -0
  135. package/dist/core/headers.d.ts +3 -0
  136. package/dist/core/headers.js +29 -0
  137. package/dist/core/index.d.ts +4 -4
  138. package/dist/core/index.js +5 -4
  139. package/dist/core/pagination/Page.d.ts +5 -2
  140. package/dist/core/pagination/Page.js +5 -2
  141. package/dist/core/pagination/Pageable.d.ts +2 -0
  142. package/dist/core/runtime/runtime.js +0 -1
  143. package/dist/errors/HumeError.d.ts +7 -2
  144. package/dist/errors/HumeError.js +10 -10
  145. package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +2 -0
  146. package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.js +2 -0
  147. package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +2 -0
  148. package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.js +2 -0
  149. package/dist/serialization/resources/empathicVoice/types/PostedNudgeSpec.d.ts +13 -0
  150. package/dist/serialization/resources/empathicVoice/types/PostedNudgeSpec.js +44 -0
  151. package/dist/serialization/resources/empathicVoice/types/ReturnConfig.d.ts +2 -0
  152. package/dist/serialization/resources/empathicVoice/types/ReturnConfig.js +2 -0
  153. package/dist/serialization/resources/empathicVoice/types/ReturnNudgeSpec.d.ts +13 -0
  154. package/dist/serialization/resources/empathicVoice/types/ReturnNudgeSpec.js +44 -0
  155. package/dist/serialization/resources/empathicVoice/types/WebhookEventChatStatus.d.ts +1 -1
  156. package/dist/serialization/resources/empathicVoice/types/WebhookEventChatStatus.js +1 -0
  157. package/dist/serialization/resources/empathicVoice/types/index.d.ts +2 -0
  158. package/dist/serialization/resources/empathicVoice/types/index.js +2 -0
  159. package/dist/serialization/resources/tts/types/Snippet.d.ts +1 -0
  160. package/dist/serialization/resources/tts/types/Snippet.js +1 -0
  161. package/dist/serialization/resources/tts/types/SnippetAudioChunk.d.ts +1 -0
  162. package/dist/serialization/resources/tts/types/SnippetAudioChunk.js +1 -0
  163. package/dist/version.d.ts +1 -1
  164. package/dist/version.js +1 -1
  165. package/dist/wrapper/expressionMeasurement/ExpressionMeasurementClient.js +2 -0
  166. package/dist/wrapper/expressionMeasurement/batch/BatchClient.d.ts +2 -1
  167. package/dist/wrapper/expressionMeasurement/batch/BatchClient.js +43 -17
  168. package/errors/HumeError.d.ts +7 -2
  169. package/errors/HumeError.js +10 -10
  170. package/package.json +9 -4
  171. package/reference.md +17 -15
  172. package/scripts/rename-to-esm-files.js +10 -2
  173. package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +2 -0
  174. package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.js +2 -0
  175. package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +2 -0
  176. package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.js +2 -0
  177. package/serialization/resources/empathicVoice/types/PostedNudgeSpec.d.ts +13 -0
  178. package/serialization/resources/empathicVoice/types/PostedNudgeSpec.js +44 -0
  179. package/serialization/resources/empathicVoice/types/ReturnConfig.d.ts +2 -0
  180. package/serialization/resources/empathicVoice/types/ReturnConfig.js +2 -0
  181. package/serialization/resources/empathicVoice/types/ReturnNudgeSpec.d.ts +13 -0
  182. package/serialization/resources/empathicVoice/types/ReturnNudgeSpec.js +44 -0
  183. package/serialization/resources/empathicVoice/types/WebhookEventChatStatus.d.ts +1 -1
  184. package/serialization/resources/empathicVoice/types/WebhookEventChatStatus.js +1 -0
  185. package/serialization/resources/empathicVoice/types/index.d.ts +2 -0
  186. package/serialization/resources/empathicVoice/types/index.js +2 -0
  187. package/serialization/resources/tts/types/Snippet.d.ts +1 -0
  188. package/serialization/resources/tts/types/Snippet.js +1 -0
  189. package/serialization/resources/tts/types/SnippetAudioChunk.d.ts +1 -0
  190. package/serialization/resources/tts/types/SnippetAudioChunk.js +1 -0
  191. package/version.d.ts +1 -1
  192. package/version.js +1 -1
  193. package/wrapper/expressionMeasurement/ExpressionMeasurementClient.js +2 -0
  194. package/wrapper/expressionMeasurement/batch/BatchClient.d.ts +2 -1
  195. package/wrapper/expressionMeasurement/batch/BatchClient.js +43 -17
  196. /package/core/{streaming-fetcher → stream}/Stream.d.ts +0 -0
  197. /package/core/{streaming-fetcher → stream}/Stream.js +0 -0
  198. /package/core/{streaming-fetcher → stream}/index.d.ts +0 -0
  199. /package/core/{streaming-fetcher → stream}/index.js +0 -0
  200. /package/dist/core/{streaming-fetcher → stream}/Stream.d.ts +0 -0
  201. /package/dist/core/{streaming-fetcher → stream}/Stream.js +0 -0
  202. /package/dist/core/{streaming-fetcher → stream}/index.d.ts +0 -0
  203. /package/dist/core/{streaming-fetcher → stream}/index.js +0 -0
@@ -47,6 +47,7 @@ export interface ReturnConfig {
47
47
  builtinTools?: (Hume.empathicVoice.ReturnBuiltinTool | undefined)[];
48
48
  eventMessages?: Hume.empathicVoice.ReturnEventMessageSpecs;
49
49
  timeouts?: Hume.empathicVoice.ReturnTimeoutSpecs;
50
+ nudges?: Hume.empathicVoice.ReturnNudgeSpec;
50
51
  /** Map of webhooks associated with this config. */
51
52
  webhooks?: (Hume.empathicVoice.ReturnWebhookSpec | undefined)[];
52
53
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * A specific nudge configuration returned from the server
6
+ */
7
+ export interface ReturnNudgeSpec {
8
+ /** EVI will nudge user after inactivity */
9
+ enabled: boolean;
10
+ /** Time interval in seconds after which the nudge will be sent. */
11
+ intervalSecs?: number;
12
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export type WebhookEventChatStatus = "ACTIVE" | "USER_ENDED" | "USER_TIMEOUT" | "INACTIVITY_TIMEOUT" | "MAX_DURATION_TIMEOUT" | "ERROR";
4
+ export type WebhookEventChatStatus = "ACTIVE" | "USER_ENDED" | "USER_TIMEOUT" | "INACTIVITY_TIMEOUT" | "MAX_DURATION_TIMEOUT" | "SILENCE_TIMEOUT" | "ERROR";
5
5
  export declare const WebhookEventChatStatus: {
6
6
  readonly Active: "ACTIVE";
7
7
  readonly UserEnded: "USER_ENDED";
8
8
  readonly UserTimeout: "USER_TIMEOUT";
9
9
  readonly InactivityTimeout: "INACTIVITY_TIMEOUT";
10
10
  readonly MaxDurationTimeout: "MAX_DURATION_TIMEOUT";
11
+ readonly SilenceTimeout: "SILENCE_TIMEOUT";
11
12
  readonly Error: "ERROR";
12
13
  };
@@ -10,5 +10,6 @@ exports.WebhookEventChatStatus = {
10
10
  UserTimeout: "USER_TIMEOUT",
11
11
  InactivityTimeout: "INACTIVITY_TIMEOUT",
12
12
  MaxDurationTimeout: "MAX_DURATION_TIMEOUT",
13
+ SilenceTimeout: "SILENCE_TIMEOUT",
13
14
  Error: "ERROR",
14
15
  };
@@ -82,6 +82,7 @@ export * from "./PostedUserDefinedToolSpec";
82
82
  export * from "./PostedBuiltinToolName";
83
83
  export * from "./PostedBuiltinTool";
84
84
  export * from "./PostedEventMessageSpecs";
85
+ export * from "./PostedNudgeSpec";
85
86
  export * from "./PostedTimeoutSpecsInactivity";
86
87
  export * from "./PostedTimeoutSpecsMaxDuration";
87
88
  export * from "./PostedTimeoutSpecs";
@@ -93,6 +94,7 @@ export * from "./ReturnBuiltinToolToolType";
93
94
  export * from "./ReturnBuiltinTool";
94
95
  export * from "./ReturnEventMessageSpecs";
95
96
  export * from "./ReturnTimeoutSpecs";
97
+ export * from "./ReturnNudgeSpec";
96
98
  export * from "./ReturnWebhookEventType";
97
99
  export * from "./ReturnWebhookSpec";
98
100
  export * from "./ReturnChatStatus";
@@ -98,6 +98,7 @@ __exportStar(require("./PostedUserDefinedToolSpec"), exports);
98
98
  __exportStar(require("./PostedBuiltinToolName"), exports);
99
99
  __exportStar(require("./PostedBuiltinTool"), exports);
100
100
  __exportStar(require("./PostedEventMessageSpecs"), exports);
101
+ __exportStar(require("./PostedNudgeSpec"), exports);
101
102
  __exportStar(require("./PostedTimeoutSpecsInactivity"), exports);
102
103
  __exportStar(require("./PostedTimeoutSpecsMaxDuration"), exports);
103
104
  __exportStar(require("./PostedTimeoutSpecs"), exports);
@@ -109,6 +110,7 @@ __exportStar(require("./ReturnBuiltinToolToolType"), exports);
109
110
  __exportStar(require("./ReturnBuiltinTool"), exports);
110
111
  __exportStar(require("./ReturnEventMessageSpecs"), exports);
111
112
  __exportStar(require("./ReturnTimeoutSpecs"), exports);
113
+ __exportStar(require("./ReturnNudgeSpec"), exports);
112
114
  __exportStar(require("./ReturnWebhookEventType"), exports);
113
115
  __exportStar(require("./ReturnWebhookSpec"), exports);
114
116
  __exportStar(require("./ReturnChatStatus"), exports);
@@ -10,6 +10,8 @@ export declare namespace ExpressionMeasurement {
10
10
  /** Specify a custom URL to connect the client to. */
11
11
  baseUrl?: core.Supplier<string>;
12
12
  apiKey?: core.Supplier<string | undefined>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
13
15
  fetcher?: core.FetchFunction;
14
16
  }
15
17
  }
@@ -13,6 +13,8 @@ export declare namespace Batch {
13
13
  /** Specify a custom URL to connect the client to. */
14
14
  baseUrl?: core.Supplier<string>;
15
15
  apiKey?: core.Supplier<string | undefined>;
16
+ /** Additional headers to include in requests. */
17
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
16
18
  fetcher?: core.FetchFunction;
17
19
  }
18
20
  interface RequestOptions {
@@ -23,7 +25,7 @@ export declare namespace Batch {
23
25
  /** A hook to abort the request. */
24
26
  abortSignal?: AbortSignal;
25
27
  /** Additional headers to include in the request. */
26
- headers?: Record<string, string>;
28
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
27
29
  }
28
30
  }
29
31
  export declare class Batch {
@@ -38,7 +40,8 @@ export declare class Batch {
38
40
  * @example
39
41
  * await client.expressionMeasurement.batch.listJobs()
40
42
  */
41
- listJobs(request?: Hume.expressionMeasurement.batch.BatchListJobsRequest, requestOptions?: Batch.RequestOptions): Promise<Hume.expressionMeasurement.batch.UnionJob[]>;
43
+ listJobs(request?: Hume.expressionMeasurement.batch.BatchListJobsRequest, requestOptions?: Batch.RequestOptions): core.HttpResponsePromise<Hume.expressionMeasurement.batch.UnionJob[]>;
44
+ private __listJobs;
42
45
  /**
43
46
  * Start a new measurement inference job.
44
47
  *
@@ -51,7 +54,8 @@ export declare class Batch {
51
54
  * notify: true
52
55
  * })
53
56
  */
54
- startInferenceJob(request: Hume.expressionMeasurement.batch.InferenceBaseRequest, requestOptions?: Batch.RequestOptions): Promise<Hume.expressionMeasurement.batch.JobId>;
57
+ startInferenceJob(request: Hume.expressionMeasurement.batch.InferenceBaseRequest, requestOptions?: Batch.RequestOptions): core.HttpResponsePromise<Hume.expressionMeasurement.batch.JobId>;
58
+ private __startInferenceJob;
55
59
  /**
56
60
  * Get the request details and state of a given job.
57
61
  *
@@ -61,7 +65,8 @@ export declare class Batch {
61
65
  * @example
62
66
  * await client.expressionMeasurement.batch.getJobDetails("job_id")
63
67
  */
64
- getJobDetails(id: string, requestOptions?: Batch.RequestOptions): Promise<Hume.expressionMeasurement.batch.UnionJob>;
68
+ getJobDetails(id: string, requestOptions?: Batch.RequestOptions): core.HttpResponsePromise<Hume.expressionMeasurement.batch.UnionJob>;
69
+ private __getJobDetails;
65
70
  /**
66
71
  * Get the JSON predictions of a completed inference job.
67
72
  *
@@ -71,11 +76,13 @@ export declare class Batch {
71
76
  * @example
72
77
  * await client.expressionMeasurement.batch.getJobPredictions("job_id")
73
78
  */
74
- getJobPredictions(id: string, requestOptions?: Batch.RequestOptions): Promise<Hume.expressionMeasurement.batch.UnionPredictResult[]>;
79
+ getJobPredictions(id: string, requestOptions?: Batch.RequestOptions): core.HttpResponsePromise<Hume.expressionMeasurement.batch.UnionPredictResult[]>;
80
+ private __getJobPredictions;
75
81
  /**
76
82
  * Get the artifacts ZIP of a completed inference job.
77
83
  */
78
- getJobArtifacts(id: string, requestOptions?: Batch.RequestOptions): Promise<stream.Readable>;
84
+ getJobArtifacts(id: string, requestOptions?: Batch.RequestOptions): core.HttpResponsePromise<stream.Readable>;
85
+ private __getJobArtifacts;
79
86
  /**
80
87
  * Start a new batch inference job.
81
88
  *
@@ -86,7 +93,8 @@ export declare class Batch {
86
93
  * @example
87
94
  * await client.expressionMeasurement.batch.startInferenceJobFromLocalFile([fs.createReadStream("/path/to/your/file")], {})
88
95
  */
89
- startInferenceJobFromLocalFile(file: File[] | fs.ReadStream[] | Blob[], request: Hume.expressionMeasurement.batch.BatchStartInferenceJobFromLocalFileRequest, requestOptions?: Batch.RequestOptions): Promise<Hume.expressionMeasurement.batch.JobId>;
96
+ startInferenceJobFromLocalFile(file: File[] | fs.ReadStream[] | Blob[], request: Hume.expressionMeasurement.batch.BatchStartInferenceJobFromLocalFileRequest, requestOptions?: Batch.RequestOptions): core.HttpResponsePromise<Hume.expressionMeasurement.batch.JobId>;
97
+ private __startInferenceJobFromLocalFile;
90
98
  protected _getCustomAuthorizationHeaders(): Promise<{
91
99
  "X-Hume-Api-Key": string | undefined;
92
100
  }>;
@@ -52,6 +52,7 @@ exports.Batch = void 0;
52
52
  const environments = __importStar(require("../../../../../../environments"));
53
53
  const core = __importStar(require("../../../../../../core"));
54
54
  const serializers = __importStar(require("../../../../../../serialization/index"));
55
+ const headers_js_1 = require("../../../../../../core/headers.js");
55
56
  const url_join_1 = __importDefault(require("url-join"));
56
57
  const errors = __importStar(require("../../../../../../errors/index"));
57
58
  const json_1 = require("../../../../../../core/json");
@@ -68,9 +69,12 @@ class Batch {
68
69
  * @example
69
70
  * await client.expressionMeasurement.batch.listJobs()
70
71
  */
71
- listJobs() {
72
+ listJobs(request = {}, requestOptions) {
73
+ return core.HttpResponsePromise.fromPromise(this.__listJobs(request, requestOptions));
74
+ }
75
+ __listJobs() {
72
76
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
73
- var _a, _b, _c;
77
+ var _a, _b, _c, _d;
74
78
  const { limit, status, when, timestampMs, sortBy, direction } = request;
75
79
  const _queryParams = {};
76
80
  if (limit != null) {
@@ -109,26 +113,28 @@ class Batch {
109
113
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
110
114
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/batch/jobs"),
111
115
  method: "GET",
112
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.1", "User-Agent": "hume/0.11.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
113
- contentType: "application/json",
116
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
114
117
  queryParameters: _queryParams,
115
- requestType: "json",
116
118
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
117
119
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
118
120
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
119
121
  });
120
122
  if (_response.ok) {
121
- return serializers.expressionMeasurement.batch.listJobs.Response.parseOrThrow(_response.body, {
122
- unrecognizedObjectKeys: "passthrough",
123
- allowUnrecognizedUnionMembers: true,
124
- allowUnrecognizedEnumValues: true,
125
- breadcrumbsPrefix: ["response"],
126
- });
123
+ return {
124
+ data: serializers.expressionMeasurement.batch.listJobs.Response.parseOrThrow(_response.body, {
125
+ unrecognizedObjectKeys: "passthrough",
126
+ allowUnrecognizedUnionMembers: true,
127
+ allowUnrecognizedEnumValues: true,
128
+ breadcrumbsPrefix: ["response"],
129
+ }),
130
+ rawResponse: _response.rawResponse,
131
+ };
127
132
  }
128
133
  if (_response.error.reason === "status-code") {
129
134
  throw new errors.HumeError({
130
135
  statusCode: _response.error.statusCode,
131
136
  body: _response.error.body,
137
+ rawResponse: _response.rawResponse,
132
138
  });
133
139
  }
134
140
  switch (_response.error.reason) {
@@ -136,12 +142,14 @@ class Batch {
136
142
  throw new errors.HumeError({
137
143
  statusCode: _response.error.statusCode,
138
144
  body: _response.error.rawBody,
145
+ rawResponse: _response.rawResponse,
139
146
  });
140
147
  case "timeout":
141
148
  throw new errors.HumeTimeoutError("Timeout exceeded when calling GET /v0/batch/jobs.");
142
149
  case "unknown":
143
150
  throw new errors.HumeError({
144
151
  message: _response.error.errorMessage,
152
+ rawResponse: _response.rawResponse,
145
153
  });
146
154
  }
147
155
  });
@@ -159,12 +167,15 @@ class Batch {
159
167
  * })
160
168
  */
161
169
  startInferenceJob(request, requestOptions) {
170
+ return core.HttpResponsePromise.fromPromise(this.__startInferenceJob(request, requestOptions));
171
+ }
172
+ __startInferenceJob(request, requestOptions) {
162
173
  return __awaiter(this, void 0, void 0, function* () {
163
- var _a, _b, _c;
174
+ var _a, _b, _c, _d;
164
175
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
165
176
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/batch/jobs"),
166
177
  method: "POST",
167
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.1", "User-Agent": "hume/0.11.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
178
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
168
179
  contentType: "application/json",
169
180
  requestType: "json",
170
181
  body: serializers.expressionMeasurement.batch.InferenceBaseRequest.jsonOrThrow(request, {
@@ -175,17 +186,21 @@ class Batch {
175
186
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
176
187
  });
177
188
  if (_response.ok) {
178
- return serializers.expressionMeasurement.batch.JobId.parseOrThrow(_response.body, {
179
- unrecognizedObjectKeys: "passthrough",
180
- allowUnrecognizedUnionMembers: true,
181
- allowUnrecognizedEnumValues: true,
182
- breadcrumbsPrefix: ["response"],
183
- });
189
+ return {
190
+ data: serializers.expressionMeasurement.batch.JobId.parseOrThrow(_response.body, {
191
+ unrecognizedObjectKeys: "passthrough",
192
+ allowUnrecognizedUnionMembers: true,
193
+ allowUnrecognizedEnumValues: true,
194
+ breadcrumbsPrefix: ["response"],
195
+ }),
196
+ rawResponse: _response.rawResponse,
197
+ };
184
198
  }
185
199
  if (_response.error.reason === "status-code") {
186
200
  throw new errors.HumeError({
187
201
  statusCode: _response.error.statusCode,
188
202
  body: _response.error.body,
203
+ rawResponse: _response.rawResponse,
189
204
  });
190
205
  }
191
206
  switch (_response.error.reason) {
@@ -193,12 +208,14 @@ class Batch {
193
208
  throw new errors.HumeError({
194
209
  statusCode: _response.error.statusCode,
195
210
  body: _response.error.rawBody,
211
+ rawResponse: _response.rawResponse,
196
212
  });
197
213
  case "timeout":
198
214
  throw new errors.HumeTimeoutError("Timeout exceeded when calling POST /v0/batch/jobs.");
199
215
  case "unknown":
200
216
  throw new errors.HumeError({
201
217
  message: _response.error.errorMessage,
218
+ rawResponse: _response.rawResponse,
202
219
  });
203
220
  }
204
221
  });
@@ -213,30 +230,35 @@ class Batch {
213
230
  * await client.expressionMeasurement.batch.getJobDetails("job_id")
214
231
  */
215
232
  getJobDetails(id, requestOptions) {
233
+ return core.HttpResponsePromise.fromPromise(this.__getJobDetails(id, requestOptions));
234
+ }
235
+ __getJobDetails(id, requestOptions) {
216
236
  return __awaiter(this, void 0, void 0, function* () {
217
- var _a, _b, _c;
237
+ var _a, _b, _c, _d;
218
238
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
219
239
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/batch/jobs/${encodeURIComponent(id)}`),
220
240
  method: "GET",
221
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.1", "User-Agent": "hume/0.11.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
222
- contentType: "application/json",
223
- requestType: "json",
241
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
224
242
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
225
243
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
226
244
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
227
245
  });
228
246
  if (_response.ok) {
229
- return serializers.expressionMeasurement.batch.UnionJob.parseOrThrow(_response.body, {
230
- unrecognizedObjectKeys: "passthrough",
231
- allowUnrecognizedUnionMembers: true,
232
- allowUnrecognizedEnumValues: true,
233
- breadcrumbsPrefix: ["response"],
234
- });
247
+ return {
248
+ data: serializers.expressionMeasurement.batch.UnionJob.parseOrThrow(_response.body, {
249
+ unrecognizedObjectKeys: "passthrough",
250
+ allowUnrecognizedUnionMembers: true,
251
+ allowUnrecognizedEnumValues: true,
252
+ breadcrumbsPrefix: ["response"],
253
+ }),
254
+ rawResponse: _response.rawResponse,
255
+ };
235
256
  }
236
257
  if (_response.error.reason === "status-code") {
237
258
  throw new errors.HumeError({
238
259
  statusCode: _response.error.statusCode,
239
260
  body: _response.error.body,
261
+ rawResponse: _response.rawResponse,
240
262
  });
241
263
  }
242
264
  switch (_response.error.reason) {
@@ -244,12 +266,14 @@ class Batch {
244
266
  throw new errors.HumeError({
245
267
  statusCode: _response.error.statusCode,
246
268
  body: _response.error.rawBody,
269
+ rawResponse: _response.rawResponse,
247
270
  });
248
271
  case "timeout":
249
272
  throw new errors.HumeTimeoutError("Timeout exceeded when calling GET /v0/batch/jobs/{id}.");
250
273
  case "unknown":
251
274
  throw new errors.HumeError({
252
275
  message: _response.error.errorMessage,
276
+ rawResponse: _response.rawResponse,
253
277
  });
254
278
  }
255
279
  });
@@ -264,30 +288,35 @@ class Batch {
264
288
  * await client.expressionMeasurement.batch.getJobPredictions("job_id")
265
289
  */
266
290
  getJobPredictions(id, requestOptions) {
291
+ return core.HttpResponsePromise.fromPromise(this.__getJobPredictions(id, requestOptions));
292
+ }
293
+ __getJobPredictions(id, requestOptions) {
267
294
  return __awaiter(this, void 0, void 0, function* () {
268
- var _a, _b, _c;
295
+ var _a, _b, _c, _d;
269
296
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
270
297
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/batch/jobs/${encodeURIComponent(id)}/predictions`),
271
298
  method: "GET",
272
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.1", "User-Agent": "hume/0.11.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
273
- contentType: "application/json",
274
- requestType: "json",
299
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
275
300
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
276
301
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
277
302
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
278
303
  });
279
304
  if (_response.ok) {
280
- return serializers.expressionMeasurement.batch.getJobPredictions.Response.parseOrThrow(_response.body, {
281
- unrecognizedObjectKeys: "passthrough",
282
- allowUnrecognizedUnionMembers: true,
283
- allowUnrecognizedEnumValues: true,
284
- breadcrumbsPrefix: ["response"],
285
- });
305
+ return {
306
+ data: serializers.expressionMeasurement.batch.getJobPredictions.Response.parseOrThrow(_response.body, {
307
+ unrecognizedObjectKeys: "passthrough",
308
+ allowUnrecognizedUnionMembers: true,
309
+ allowUnrecognizedEnumValues: true,
310
+ breadcrumbsPrefix: ["response"],
311
+ }),
312
+ rawResponse: _response.rawResponse,
313
+ };
286
314
  }
287
315
  if (_response.error.reason === "status-code") {
288
316
  throw new errors.HumeError({
289
317
  statusCode: _response.error.statusCode,
290
318
  body: _response.error.body,
319
+ rawResponse: _response.rawResponse,
291
320
  });
292
321
  }
293
322
  switch (_response.error.reason) {
@@ -295,12 +324,14 @@ class Batch {
295
324
  throw new errors.HumeError({
296
325
  statusCode: _response.error.statusCode,
297
326
  body: _response.error.rawBody,
327
+ rawResponse: _response.rawResponse,
298
328
  });
299
329
  case "timeout":
300
330
  throw new errors.HumeTimeoutError("Timeout exceeded when calling GET /v0/batch/jobs/{id}/predictions.");
301
331
  case "unknown":
302
332
  throw new errors.HumeError({
303
333
  message: _response.error.errorMessage,
334
+ rawResponse: _response.rawResponse,
304
335
  });
305
336
  }
306
337
  });
@@ -309,26 +340,28 @@ class Batch {
309
340
  * Get the artifacts ZIP of a completed inference job.
310
341
  */
311
342
  getJobArtifacts(id, requestOptions) {
343
+ return core.HttpResponsePromise.fromPromise(this.__getJobArtifacts(id, requestOptions));
344
+ }
345
+ __getJobArtifacts(id, requestOptions) {
312
346
  return __awaiter(this, void 0, void 0, function* () {
313
- var _a, _b, _c;
347
+ var _a, _b, _c, _d;
314
348
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
315
349
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/batch/jobs/${encodeURIComponent(id)}/artifacts`),
316
350
  method: "GET",
317
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.1", "User-Agent": "hume/0.11.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
318
- contentType: "application/json",
319
- requestType: "json",
351
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
320
352
  responseType: "streaming",
321
353
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
322
354
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
323
355
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
324
356
  });
325
357
  if (_response.ok) {
326
- return _response.body;
358
+ return { data: _response.body, rawResponse: _response.rawResponse };
327
359
  }
328
360
  if (_response.error.reason === "status-code") {
329
361
  throw new errors.HumeError({
330
362
  statusCode: _response.error.statusCode,
331
363
  body: _response.error.body,
364
+ rawResponse: _response.rawResponse,
332
365
  });
333
366
  }
334
367
  switch (_response.error.reason) {
@@ -336,12 +369,14 @@ class Batch {
336
369
  throw new errors.HumeError({
337
370
  statusCode: _response.error.statusCode,
338
371
  body: _response.error.rawBody,
372
+ rawResponse: _response.rawResponse,
339
373
  });
340
374
  case "timeout":
341
375
  throw new errors.HumeTimeoutError("Timeout exceeded when calling GET /v0/batch/jobs/{id}/artifacts.");
342
376
  case "unknown":
343
377
  throw new errors.HumeError({
344
378
  message: _response.error.errorMessage,
379
+ rawResponse: _response.rawResponse,
345
380
  });
346
381
  }
347
382
  });
@@ -357,8 +392,11 @@ class Batch {
357
392
  * await client.expressionMeasurement.batch.startInferenceJobFromLocalFile([fs.createReadStream("/path/to/your/file")], {})
358
393
  */
359
394
  startInferenceJobFromLocalFile(file, request, requestOptions) {
395
+ return core.HttpResponsePromise.fromPromise(this.__startInferenceJobFromLocalFile(file, request, requestOptions));
396
+ }
397
+ __startInferenceJobFromLocalFile(file, request, requestOptions) {
360
398
  return __awaiter(this, void 0, void 0, function* () {
361
- var _a, _b, _c;
399
+ var _a, _b, _c, _d;
362
400
  const _request = yield core.newFormData();
363
401
  if (request.json != null) {
364
402
  _request.append("json", (0, json_1.toJson)(serializers.expressionMeasurement.batch.InferenceBaseRequest.jsonOrThrow(request.json, {
@@ -372,7 +410,7 @@ class Batch {
372
410
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
373
411
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/batch/jobs"),
374
412
  method: "POST",
375
- headers: Object.assign(Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.1", "User-Agent": "hume/0.11.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
413
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign(Object.assign({}, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
376
414
  requestType: "file",
377
415
  duplex: _maybeEncodedRequest.duplex,
378
416
  body: _maybeEncodedRequest.body,
@@ -381,17 +419,21 @@ class Batch {
381
419
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
382
420
  });
383
421
  if (_response.ok) {
384
- return serializers.expressionMeasurement.batch.JobId.parseOrThrow(_response.body, {
385
- unrecognizedObjectKeys: "passthrough",
386
- allowUnrecognizedUnionMembers: true,
387
- allowUnrecognizedEnumValues: true,
388
- breadcrumbsPrefix: ["response"],
389
- });
422
+ return {
423
+ data: serializers.expressionMeasurement.batch.JobId.parseOrThrow(_response.body, {
424
+ unrecognizedObjectKeys: "passthrough",
425
+ allowUnrecognizedUnionMembers: true,
426
+ allowUnrecognizedEnumValues: true,
427
+ breadcrumbsPrefix: ["response"],
428
+ }),
429
+ rawResponse: _response.rawResponse,
430
+ };
390
431
  }
391
432
  if (_response.error.reason === "status-code") {
392
433
  throw new errors.HumeError({
393
434
  statusCode: _response.error.statusCode,
394
435
  body: _response.error.body,
436
+ rawResponse: _response.rawResponse,
395
437
  });
396
438
  }
397
439
  switch (_response.error.reason) {
@@ -399,12 +441,14 @@ class Batch {
399
441
  throw new errors.HumeError({
400
442
  statusCode: _response.error.statusCode,
401
443
  body: _response.error.rawBody,
444
+ rawResponse: _response.rawResponse,
402
445
  });
403
446
  case "timeout":
404
447
  throw new errors.HumeTimeoutError("Timeout exceeded when calling POST /v0/batch/jobs.");
405
448
  case "unknown":
406
449
  throw new errors.HumeError({
407
450
  message: _response.error.errorMessage,
451
+ rawResponse: _response.rawResponse,
408
452
  });
409
453
  }
410
454
  });
@@ -12,6 +12,8 @@ export declare namespace Tts {
12
12
  /** Specify a custom URL to connect the client to. */
13
13
  baseUrl?: core.Supplier<string>;
14
14
  apiKey?: core.Supplier<string | undefined>;
15
+ /** Additional headers to include in requests. */
16
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
17
  fetcher?: core.FetchFunction;
16
18
  }
17
19
  interface RequestOptions {
@@ -22,7 +24,7 @@ export declare namespace Tts {
22
24
  /** A hook to abort the request. */
23
25
  abortSignal?: AbortSignal;
24
26
  /** Additional headers to include in the request. */
25
- headers?: Record<string, string>;
27
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
26
28
  }
27
29
  }
28
30
  export declare class Tts {
@@ -35,48 +37,54 @@ export declare class Tts {
35
37
  *
36
38
  * The response includes the base64-encoded audio and metadata in JSON format.
37
39
  *
38
- * @param {Hume.tts.PostedTts} request
40
+ * @param {Hume.tts.SynthesizeJsonRequest} request
39
41
  * @param {Tts.RequestOptions} requestOptions - Request-specific configuration.
40
42
  *
41
43
  * @throws {@link Hume.tts.UnprocessableEntityError}
42
44
  *
43
45
  * @example
44
46
  * await client.tts.synthesizeJson({
45
- * utterances: [{
46
- * text: "Beauty is no quality in things themselves: It exists merely in the mind which contemplates them.",
47
- * description: "Middle-aged masculine voice with a clear, rhythmic Scots lilt, rounded vowels, and a warm, steady tone with an articulate, academic quality."
48
- * }],
49
- * context: {
47
+ * body: {
50
48
  * utterances: [{
51
- * text: "How can people see beauty so differently?",
52
- * description: "A curious student with a clear and respectful tone, seeking clarification on Hume's ideas with a straightforward question."
53
- * }]
54
- * },
55
- * format: {
56
- * type: "mp3"
57
- * },
58
- * numGenerations: 1
49
+ * text: "Beauty is no quality in things themselves: It exists merely in the mind which contemplates them.",
50
+ * description: "Middle-aged masculine voice with a clear, rhythmic Scots lilt, rounded vowels, and a warm, steady tone with an articulate, academic quality."
51
+ * }],
52
+ * context: {
53
+ * utterances: [{
54
+ * text: "How can people see beauty so differently?",
55
+ * description: "A curious student with a clear and respectful tone, seeking clarification on Hume's ideas with a straightforward question."
56
+ * }]
57
+ * },
58
+ * format: {
59
+ * type: "mp3"
60
+ * },
61
+ * numGenerations: 1
62
+ * }
59
63
  * })
60
64
  */
61
- synthesizeJson(request: Hume.tts.PostedTts, requestOptions?: Tts.RequestOptions): Promise<Hume.tts.ReturnTts>;
65
+ synthesizeJson(request: Hume.tts.SynthesizeJsonRequest, requestOptions?: Tts.RequestOptions): core.HttpResponsePromise<Hume.tts.ReturnTts>;
66
+ private __synthesizeJson;
62
67
  /**
63
68
  * Synthesizes one or more input texts into speech using the specified voice. If no voice is provided, a novel voice will be generated dynamically. Optionally, additional context can be included to influence the speech's style and prosody.
64
69
  *
65
70
  * The response contains the generated audio file in the requested format.
66
71
  * @throws {@link Hume.tts.UnprocessableEntityError}
67
72
  */
68
- synthesizeFile(request: Hume.tts.PostedTts, requestOptions?: Tts.RequestOptions): Promise<stream.Readable>;
73
+ synthesizeFile(request: Hume.tts.PostedTts, requestOptions?: Tts.RequestOptions): core.HttpResponsePromise<stream.Readable>;
74
+ private __synthesizeFile;
69
75
  /**
70
76
  * Streams synthesized speech using the specified voice. If no voice is provided, a novel voice will be generated dynamically. Optionally, additional context can be included to influence the speech's style and prosody.
71
77
  * @throws {@link Hume.tts.UnprocessableEntityError}
72
78
  */
73
- synthesizeFileStreaming(request: Hume.tts.PostedTts, requestOptions?: Tts.RequestOptions): Promise<stream.Readable>;
79
+ synthesizeFileStreaming(request: Hume.tts.PostedTts, requestOptions?: Tts.RequestOptions): core.HttpResponsePromise<stream.Readable>;
80
+ private __synthesizeFileStreaming;
74
81
  /**
75
82
  * Streams synthesized speech using the specified voice. If no voice is provided, a novel voice will be generated dynamically. Optionally, additional context can be included to influence the speech's style and prosody.
76
83
  *
77
84
  * The response is a stream of JSON objects including audio encoded in base64.
78
85
  */
79
- synthesizeJsonStreaming(request: Hume.tts.PostedTts, requestOptions?: Tts.RequestOptions): Promise<core.Stream<Hume.tts.SnippetAudioChunk>>;
86
+ synthesizeJsonStreaming(request: Hume.tts.PostedTts, requestOptions?: Tts.RequestOptions): core.HttpResponsePromise<core.Stream<Hume.tts.SnippetAudioChunk>>;
87
+ private __synthesizeJsonStreaming;
80
88
  protected _getCustomAuthorizationHeaders(): Promise<{
81
89
  "X-Hume-Api-Key": string | undefined;
82
90
  }>;