@mistralai/mistralai 1.7.4 → 1.9.17

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 (181) hide show
  1. package/README.md +10 -0
  2. package/docs/sdks/accesses/README.md +2 -0
  3. package/docs/sdks/audio/README.md +6 -0
  4. package/docs/sdks/documents/README.md +2 -0
  5. package/docs/sdks/libraries/README.md +1 -1
  6. package/docs/sdks/transcriptions/README.md +167 -0
  7. package/examples/src/async_audio_transcription_stream.ts +17 -0
  8. package/funcs/audioTranscriptionsComplete.d.ts +13 -0
  9. package/funcs/audioTranscriptionsComplete.d.ts.map +1 -0
  10. package/funcs/audioTranscriptionsComplete.js +133 -0
  11. package/funcs/audioTranscriptionsComplete.js.map +1 -0
  12. package/funcs/audioTranscriptionsStream.d.ts +14 -0
  13. package/funcs/audioTranscriptionsStream.d.ts.map +1 -0
  14. package/funcs/audioTranscriptionsStream.js +143 -0
  15. package/funcs/audioTranscriptionsStream.js.map +1 -0
  16. package/funcs/batchJobsList.js +1 -0
  17. package/funcs/batchJobsList.js.map +1 -1
  18. package/jsr.json +1 -1
  19. package/lib/config.d.ts +2 -2
  20. package/lib/config.js +2 -2
  21. package/lib/config.js.map +1 -1
  22. package/models/components/audiochunk.d.ts +54 -0
  23. package/models/components/audiochunk.d.ts.map +1 -0
  24. package/models/components/audiochunk.js +88 -0
  25. package/models/components/audiochunk.js.map +1 -0
  26. package/models/components/audiotranscriptionrequest.d.ts +57 -0
  27. package/models/components/audiotranscriptionrequest.d.ts.map +1 -0
  28. package/models/components/audiotranscriptionrequest.js +91 -0
  29. package/models/components/audiotranscriptionrequest.js.map +1 -0
  30. package/models/components/audiotranscriptionrequeststream.d.ts +57 -0
  31. package/models/components/audiotranscriptionrequeststream.d.ts.map +1 -0
  32. package/models/components/audiotranscriptionrequeststream.js +91 -0
  33. package/models/components/audiotranscriptionrequeststream.js.map +1 -0
  34. package/models/components/basemodelcard.d.ts +7 -7
  35. package/models/components/basemodelcard.d.ts.map +1 -1
  36. package/models/components/basemodelcard.js +11 -11
  37. package/models/components/basemodelcard.js.map +1 -1
  38. package/models/components/batchjobin.d.ts +4 -2
  39. package/models/components/batchjobin.d.ts.map +1 -1
  40. package/models/components/batchjobin.js +6 -2
  41. package/models/components/batchjobin.js.map +1 -1
  42. package/models/components/batchjobout.d.ts +4 -2
  43. package/models/components/batchjobout.d.ts.map +1 -1
  44. package/models/components/batchjobout.js +6 -2
  45. package/models/components/batchjobout.js.map +1 -1
  46. package/models/components/classifierftmodelout.d.ts +4 -0
  47. package/models/components/classifierftmodelout.d.ts.map +1 -1
  48. package/models/components/classifierftmodelout.js +8 -0
  49. package/models/components/classifierftmodelout.js.map +1 -1
  50. package/models/components/completionargs.d.ts +2 -2
  51. package/models/components/completionargs.d.ts.map +1 -1
  52. package/models/components/completionargs.js +2 -2
  53. package/models/components/completionargs.js.map +1 -1
  54. package/models/components/completionftmodelout.d.ts +4 -0
  55. package/models/components/completionftmodelout.d.ts.map +1 -1
  56. package/models/components/completionftmodelout.js +8 -0
  57. package/models/components/completionftmodelout.js.map +1 -1
  58. package/models/components/contentchunk.d.ts +10 -0
  59. package/models/components/contentchunk.d.ts.map +1 -1
  60. package/models/components/contentchunk.js +14 -0
  61. package/models/components/contentchunk.js.map +1 -1
  62. package/models/components/fileschema.d.ts +4 -0
  63. package/models/components/fileschema.d.ts.map +1 -1
  64. package/models/components/fileschema.js +4 -0
  65. package/models/components/fileschema.js.map +1 -1
  66. package/models/components/index.d.ts +13 -0
  67. package/models/components/index.d.ts.map +1 -1
  68. package/models/components/index.js +13 -0
  69. package/models/components/index.js.map +1 -1
  70. package/models/components/messageoutputcontentchunks.d.ts +3 -2
  71. package/models/components/messageoutputcontentchunks.d.ts.map +1 -1
  72. package/models/components/messageoutputcontentchunks.js +3 -0
  73. package/models/components/messageoutputcontentchunks.js.map +1 -1
  74. package/models/components/outputcontentchunks.d.ts +3 -2
  75. package/models/components/outputcontentchunks.d.ts.map +1 -1
  76. package/models/components/outputcontentchunks.js +3 -0
  77. package/models/components/outputcontentchunks.js.map +1 -1
  78. package/models/components/retrievefileout.d.ts +4 -0
  79. package/models/components/retrievefileout.d.ts.map +1 -1
  80. package/models/components/retrievefileout.js +4 -0
  81. package/models/components/retrievefileout.js.map +1 -1
  82. package/models/components/thinkchunk.d.ts +82 -0
  83. package/models/components/thinkchunk.d.ts.map +1 -0
  84. package/models/components/thinkchunk.js +106 -0
  85. package/models/components/thinkchunk.js.map +1 -0
  86. package/models/components/timestampgranularity.d.ts +25 -0
  87. package/models/components/timestampgranularity.d.ts.map +1 -0
  88. package/models/components/timestampgranularity.js +49 -0
  89. package/models/components/timestampgranularity.js.map +1 -0
  90. package/models/components/transcriptionresponse.d.ts +43 -0
  91. package/models/components/transcriptionresponse.d.ts.map +1 -0
  92. package/models/components/transcriptionresponse.js +78 -0
  93. package/models/components/transcriptionresponse.js.map +1 -0
  94. package/models/components/transcriptionsegmentchunk.d.ts +62 -0
  95. package/models/components/transcriptionsegmentchunk.d.ts.map +1 -0
  96. package/models/components/transcriptionsegmentchunk.js +92 -0
  97. package/models/components/transcriptionsegmentchunk.js.map +1 -0
  98. package/models/components/transcriptionstreamdone.d.ts +68 -0
  99. package/models/components/transcriptionstreamdone.d.ts.map +1 -0
  100. package/models/components/transcriptionstreamdone.js +98 -0
  101. package/models/components/transcriptionstreamdone.js.map +1 -0
  102. package/models/components/transcriptionstreamevents.d.ts +89 -0
  103. package/models/components/transcriptionstreamevents.d.ts.map +1 -0
  104. package/models/components/transcriptionstreamevents.js +138 -0
  105. package/models/components/transcriptionstreamevents.js.map +1 -0
  106. package/models/components/transcriptionstreameventtypes.d.ts +34 -0
  107. package/models/components/transcriptionstreameventtypes.d.ts.map +1 -0
  108. package/models/components/transcriptionstreameventtypes.js +52 -0
  109. package/models/components/transcriptionstreameventtypes.js.map +1 -0
  110. package/models/components/transcriptionstreamlanguage.d.ts +58 -0
  111. package/models/components/transcriptionstreamlanguage.d.ts.map +1 -0
  112. package/models/components/transcriptionstreamlanguage.js +93 -0
  113. package/models/components/transcriptionstreamlanguage.js.map +1 -0
  114. package/models/components/transcriptionstreamsegmentdelta.d.ts +62 -0
  115. package/models/components/transcriptionstreamsegmentdelta.d.ts.map +1 -0
  116. package/models/components/transcriptionstreamsegmentdelta.js +92 -0
  117. package/models/components/transcriptionstreamsegmentdelta.js.map +1 -0
  118. package/models/components/transcriptionstreamtextdelta.d.ts +58 -0
  119. package/models/components/transcriptionstreamtextdelta.d.ts.map +1 -0
  120. package/models/components/transcriptionstreamtextdelta.js +88 -0
  121. package/models/components/transcriptionstreamtextdelta.js.map +1 -0
  122. package/models/components/uploadfileout.d.ts +4 -0
  123. package/models/components/uploadfileout.d.ts.map +1 -1
  124. package/models/components/uploadfileout.js +4 -0
  125. package/models/components/uploadfileout.js.map +1 -1
  126. package/models/components/usageinfo.d.ts +9 -3
  127. package/models/components/usageinfo.d.ts.map +1 -1
  128. package/models/components/usageinfo.js +22 -13
  129. package/models/components/usageinfo.js.map +1 -1
  130. package/models/operations/jobsapiroutesbatchgetbatchjobs.d.ts +2 -0
  131. package/models/operations/jobsapiroutesbatchgetbatchjobs.d.ts.map +1 -1
  132. package/models/operations/jobsapiroutesbatchgetbatchjobs.js +4 -0
  133. package/models/operations/jobsapiroutesbatchgetbatchjobs.js.map +1 -1
  134. package/package.json +1 -1
  135. package/sdk/audio.d.ts +7 -0
  136. package/sdk/audio.d.ts.map +1 -0
  137. package/sdk/audio.js +15 -0
  138. package/sdk/audio.js.map +1 -0
  139. package/sdk/sdk.d.ts +3 -0
  140. package/sdk/sdk.d.ts.map +1 -1
  141. package/sdk/sdk.js +4 -0
  142. package/sdk/sdk.js.map +1 -1
  143. package/sdk/transcriptions.d.ts +14 -0
  144. package/sdk/transcriptions.d.ts.map +1 -0
  145. package/sdk/transcriptions.js +26 -0
  146. package/sdk/transcriptions.js.map +1 -0
  147. package/src/funcs/audioTranscriptionsComplete.ts +193 -0
  148. package/src/funcs/audioTranscriptionsStream.ts +207 -0
  149. package/src/funcs/batchJobsList.ts +1 -0
  150. package/src/lib/config.ts +2 -2
  151. package/src/models/components/audiochunk.ts +102 -0
  152. package/src/models/components/audiotranscriptionrequest.ts +133 -0
  153. package/src/models/components/audiotranscriptionrequeststream.ts +135 -0
  154. package/src/models/components/basemodelcard.ts +13 -12
  155. package/src/models/components/batchjobin.ts +10 -4
  156. package/src/models/components/batchjobout.ts +10 -4
  157. package/src/models/components/classifierftmodelout.ts +12 -0
  158. package/src/models/components/completionargs.ts +4 -4
  159. package/src/models/components/completionftmodelout.ts +12 -0
  160. package/src/models/components/contentchunk.ts +38 -2
  161. package/src/models/components/fileschema.ts +8 -0
  162. package/src/models/components/index.ts +13 -0
  163. package/src/models/components/messageoutputcontentchunks.ts +10 -0
  164. package/src/models/components/outputcontentchunks.ts +10 -0
  165. package/src/models/components/retrievefileout.ts +8 -0
  166. package/src/models/components/thinkchunk.ts +162 -0
  167. package/src/models/components/timestampgranularity.ts +32 -0
  168. package/src/models/components/transcriptionresponse.ts +112 -0
  169. package/src/models/components/transcriptionsegmentchunk.ts +122 -0
  170. package/src/models/components/transcriptionstreamdone.ts +149 -0
  171. package/src/models/components/transcriptionstreamevents.ts +273 -0
  172. package/src/models/components/transcriptionstreameventtypes.ts +37 -0
  173. package/src/models/components/transcriptionstreamlanguage.ts +128 -0
  174. package/src/models/components/transcriptionstreamsegmentdelta.ts +133 -0
  175. package/src/models/components/transcriptionstreamtextdelta.ts +123 -0
  176. package/src/models/components/uploadfileout.ts +8 -0
  177. package/src/models/components/usageinfo.ts +37 -17
  178. package/src/models/operations/jobsapiroutesbatchgetbatchjobs.ts +6 -0
  179. package/src/sdk/audio.ts +13 -0
  180. package/src/sdk/sdk.ts +6 -0
  181. package/src/sdk/transcriptions.ts +40 -0
@@ -0,0 +1,193 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { MistralCore } from "../core.js";
6
+ import { appendForm } from "../lib/encodings.js";
7
+ import { readableStreamToArrayBuffer } from "../lib/files.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import { SDKError } from "../models/errors/sdkerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
25
+ import { isBlobLike } from "../types/blobs.js";
26
+ import { Result } from "../types/fp.js";
27
+ import { isReadableStream } from "../types/streams.js";
28
+
29
+ /**
30
+ * Create Transcription
31
+ */
32
+ export function audioTranscriptionsComplete(
33
+ client: MistralCore,
34
+ request: components.AudioTranscriptionRequest,
35
+ options?: RequestOptions,
36
+ ): APIPromise<
37
+ Result<
38
+ components.TranscriptionResponse,
39
+ | SDKError
40
+ | SDKValidationError
41
+ | UnexpectedClientError
42
+ | InvalidRequestError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | ConnectionError
46
+ >
47
+ > {
48
+ return new APIPromise($do(
49
+ client,
50
+ request,
51
+ options,
52
+ ));
53
+ }
54
+
55
+ async function $do(
56
+ client: MistralCore,
57
+ request: components.AudioTranscriptionRequest,
58
+ options?: RequestOptions,
59
+ ): Promise<
60
+ [
61
+ Result<
62
+ components.TranscriptionResponse,
63
+ | SDKError
64
+ | SDKValidationError
65
+ | UnexpectedClientError
66
+ | InvalidRequestError
67
+ | RequestAbortedError
68
+ | RequestTimeoutError
69
+ | ConnectionError
70
+ >,
71
+ APICall,
72
+ ]
73
+ > {
74
+ const parsed = safeParse(
75
+ request,
76
+ (value) => components.AudioTranscriptionRequest$outboundSchema.parse(value),
77
+ "Input validation failed",
78
+ );
79
+ if (!parsed.ok) {
80
+ return [parsed, { status: "invalid" }];
81
+ }
82
+ const payload = parsed.value;
83
+ const body = new FormData();
84
+
85
+ appendForm(body, "model", payload.model);
86
+ if (payload.file !== undefined) {
87
+ if (isBlobLike(payload.file)) {
88
+ appendForm(body, "file", payload.file);
89
+ } else if (isReadableStream(payload.file.content)) {
90
+ const buffer = await readableStreamToArrayBuffer(payload.file.content);
91
+ const blob = new Blob([buffer], { type: "application/octet-stream" });
92
+ appendForm(body, "file", blob);
93
+ } else {
94
+ appendForm(
95
+ body,
96
+ "file",
97
+ new Blob([payload.file.content], { type: "application/octet-stream" }),
98
+ payload.file.fileName,
99
+ );
100
+ }
101
+ }
102
+ if (payload.file_id !== undefined) {
103
+ appendForm(body, "file_id", payload.file_id);
104
+ }
105
+ if (payload.file_url !== undefined) {
106
+ appendForm(body, "file_url", payload.file_url);
107
+ }
108
+ if (payload.language !== undefined) {
109
+ appendForm(body, "language", payload.language);
110
+ }
111
+ if (payload.stream !== undefined) {
112
+ appendForm(body, "stream", payload.stream);
113
+ }
114
+ if (payload.temperature !== undefined) {
115
+ appendForm(body, "temperature", payload.temperature);
116
+ }
117
+ if (payload.timestamp_granularities !== undefined) {
118
+ appendForm(
119
+ body,
120
+ "timestamp_granularities",
121
+ payload.timestamp_granularities,
122
+ );
123
+ }
124
+
125
+ const path = pathToFunc("/v1/audio/transcriptions")();
126
+
127
+ const headers = new Headers(compactMap({
128
+ Accept: "application/json",
129
+ }));
130
+
131
+ const secConfig = await extractSecurity(client._options.apiKey);
132
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
133
+ const requestSecurity = resolveGlobalSecurity(securityInput);
134
+
135
+ const context = {
136
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
137
+ operationID: "audio_api_v1_transcriptions_post",
138
+ oAuth2Scopes: [],
139
+
140
+ resolvedSecurity: requestSecurity,
141
+
142
+ securitySource: client._options.apiKey,
143
+ retryConfig: options?.retries
144
+ || client._options.retryConfig
145
+ || { strategy: "none" },
146
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
147
+ };
148
+
149
+ const requestRes = client._createRequest(context, {
150
+ security: requestSecurity,
151
+ method: "POST",
152
+ baseURL: options?.serverURL,
153
+ path: path,
154
+ headers: headers,
155
+ body: body,
156
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
157
+ }, options);
158
+ if (!requestRes.ok) {
159
+ return [requestRes, { status: "invalid" }];
160
+ }
161
+ const req = requestRes.value;
162
+
163
+ const doResult = await client._do(req, {
164
+ context,
165
+ errorCodes: ["4XX", "5XX"],
166
+ retryConfig: context.retryConfig,
167
+ retryCodes: context.retryCodes,
168
+ });
169
+ if (!doResult.ok) {
170
+ return [doResult, { status: "request-error", request: req }];
171
+ }
172
+ const response = doResult.value;
173
+
174
+ const [result] = await M.match<
175
+ components.TranscriptionResponse,
176
+ | SDKError
177
+ | SDKValidationError
178
+ | UnexpectedClientError
179
+ | InvalidRequestError
180
+ | RequestAbortedError
181
+ | RequestTimeoutError
182
+ | ConnectionError
183
+ >(
184
+ M.json(200, components.TranscriptionResponse$inboundSchema),
185
+ M.fail("4XX"),
186
+ M.fail("5XX"),
187
+ )(response);
188
+ if (!result.ok) {
189
+ return [result, { status: "complete", request: req, response }];
190
+ }
191
+
192
+ return [result, { status: "complete", request: req, response }];
193
+ }
@@ -0,0 +1,207 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { MistralCore } from "../core.js";
7
+ import { appendForm } from "../lib/encodings.js";
8
+ import { EventStream } from "../lib/event-streams.js";
9
+ import { readableStreamToArrayBuffer } from "../lib/files.js";
10
+ import * as M from "../lib/matchers.js";
11
+ import { compactMap } from "../lib/primitives.js";
12
+ import { safeParse } from "../lib/schemas.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
15
+ import { pathToFunc } from "../lib/url.js";
16
+ import * as components from "../models/components/index.js";
17
+ import {
18
+ ConnectionError,
19
+ InvalidRequestError,
20
+ RequestAbortedError,
21
+ RequestTimeoutError,
22
+ UnexpectedClientError,
23
+ } from "../models/errors/httpclienterrors.js";
24
+ import { SDKError } from "../models/errors/sdkerror.js";
25
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { isBlobLike } from "../types/blobs.js";
28
+ import { Result } from "../types/fp.js";
29
+ import { isReadableStream } from "../types/streams.js";
30
+
31
+ /**
32
+ * Create streaming transcription (SSE)
33
+ */
34
+ export function audioTranscriptionsStream(
35
+ client: MistralCore,
36
+ request: components.AudioTranscriptionRequestStream,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ EventStream<components.TranscriptionStreamEvents>,
41
+ | SDKError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: MistralCore,
59
+ request: components.AudioTranscriptionRequestStream,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ EventStream<components.TranscriptionStreamEvents>,
65
+ | SDKError
66
+ | SDKValidationError
67
+ | UnexpectedClientError
68
+ | InvalidRequestError
69
+ | RequestAbortedError
70
+ | RequestTimeoutError
71
+ | ConnectionError
72
+ >,
73
+ APICall,
74
+ ]
75
+ > {
76
+ const parsed = safeParse(
77
+ request,
78
+ (value) =>
79
+ components.AudioTranscriptionRequestStream$outboundSchema.parse(value),
80
+ "Input validation failed",
81
+ );
82
+ if (!parsed.ok) {
83
+ return [parsed, { status: "invalid" }];
84
+ }
85
+ const payload = parsed.value;
86
+ const body = new FormData();
87
+
88
+ appendForm(body, "model", payload.model);
89
+ if (payload.file !== undefined) {
90
+ if (isBlobLike(payload.file)) {
91
+ appendForm(body, "file", payload.file);
92
+ } else if (isReadableStream(payload.file.content)) {
93
+ const buffer = await readableStreamToArrayBuffer(payload.file.content);
94
+ const blob = new Blob([buffer], { type: "application/octet-stream" });
95
+ appendForm(body, "file", blob);
96
+ } else {
97
+ appendForm(
98
+ body,
99
+ "file",
100
+ new Blob([payload.file.content], { type: "application/octet-stream" }),
101
+ payload.file.fileName,
102
+ );
103
+ }
104
+ }
105
+ if (payload.file_id !== undefined) {
106
+ appendForm(body, "file_id", payload.file_id);
107
+ }
108
+ if (payload.file_url !== undefined) {
109
+ appendForm(body, "file_url", payload.file_url);
110
+ }
111
+ if (payload.language !== undefined) {
112
+ appendForm(body, "language", payload.language);
113
+ }
114
+ if (payload.stream !== undefined) {
115
+ appendForm(body, "stream", payload.stream);
116
+ }
117
+ if (payload.temperature !== undefined) {
118
+ appendForm(body, "temperature", payload.temperature);
119
+ }
120
+ if (payload.timestamp_granularities !== undefined) {
121
+ appendForm(
122
+ body,
123
+ "timestamp_granularities",
124
+ payload.timestamp_granularities,
125
+ );
126
+ }
127
+
128
+ const path = pathToFunc("/v1/audio/transcriptions#stream")();
129
+
130
+ const headers = new Headers(compactMap({
131
+ Accept: "text/event-stream",
132
+ }));
133
+
134
+ const secConfig = await extractSecurity(client._options.apiKey);
135
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
136
+ const requestSecurity = resolveGlobalSecurity(securityInput);
137
+
138
+ const context = {
139
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
140
+ operationID: "audio_api_v1_transcriptions_post_stream",
141
+ oAuth2Scopes: [],
142
+
143
+ resolvedSecurity: requestSecurity,
144
+
145
+ securitySource: client._options.apiKey,
146
+ retryConfig: options?.retries
147
+ || client._options.retryConfig
148
+ || { strategy: "none" },
149
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
150
+ };
151
+
152
+ const requestRes = client._createRequest(context, {
153
+ security: requestSecurity,
154
+ method: "POST",
155
+ baseURL: options?.serverURL,
156
+ path: path,
157
+ headers: headers,
158
+ body: body,
159
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
160
+ }, options);
161
+ if (!requestRes.ok) {
162
+ return [requestRes, { status: "invalid" }];
163
+ }
164
+ const req = requestRes.value;
165
+
166
+ const doResult = await client._do(req, {
167
+ context,
168
+ errorCodes: ["4XX", "5XX"],
169
+ retryConfig: context.retryConfig,
170
+ retryCodes: context.retryCodes,
171
+ });
172
+ if (!doResult.ok) {
173
+ return [doResult, { status: "request-error", request: req }];
174
+ }
175
+ const response = doResult.value;
176
+
177
+ const [result] = await M.match<
178
+ EventStream<components.TranscriptionStreamEvents>,
179
+ | SDKError
180
+ | SDKValidationError
181
+ | UnexpectedClientError
182
+ | InvalidRequestError
183
+ | RequestAbortedError
184
+ | RequestTimeoutError
185
+ | ConnectionError
186
+ >(
187
+ M.sse(
188
+ 200,
189
+ z.instanceof(ReadableStream<Uint8Array>).transform(stream => {
190
+ return new EventStream({
191
+ stream,
192
+ decoder(rawEvent) {
193
+ const schema = components.TranscriptionStreamEvents$inboundSchema;
194
+ return schema.parse(rawEvent);
195
+ },
196
+ });
197
+ }),
198
+ ),
199
+ M.fail("4XX"),
200
+ M.fail("5XX"),
201
+ )(response);
202
+ if (!result.ok) {
203
+ return [result, { status: "complete", request: req, response }];
204
+ }
205
+
206
+ return [result, { status: "complete", request: req, response }];
207
+ }
@@ -88,6 +88,7 @@ async function $do(
88
88
  const path = pathToFunc("/v1/batch/jobs")();
89
89
 
90
90
  const query = encodeFormQuery({
91
+ "agent_id": payload?.agent_id,
91
92
  "created_after": payload?.created_after,
92
93
  "created_by_me": payload?.created_by_me,
93
94
  "metadata": payload?.metadata,
package/src/lib/config.ts CHANGED
@@ -55,8 +55,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
55
55
  export const SDK_METADATA = {
56
56
  language: "typescript",
57
57
  openapiDocVersion: "1.0.0",
58
- sdkVersion: "1.7.4",
58
+ sdkVersion: "1.9.17",
59
59
  genVersion: "2.548.6",
60
60
  userAgent:
61
- "speakeasy-sdk/typescript 1.7.4 2.548.6 1.0.0 @mistralai/mistralai",
61
+ "speakeasy-sdk/typescript 1.9.17 2.548.6 1.0.0 @mistralai/mistralai",
62
62
  } as const;
@@ -0,0 +1,102 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ export const AudioChunkType = {
13
+ InputAudio: "input_audio",
14
+ } as const;
15
+ export type AudioChunkType = ClosedEnum<typeof AudioChunkType>;
16
+
17
+ export type AudioChunk = {
18
+ inputAudio: string;
19
+ type?: AudioChunkType | undefined;
20
+ };
21
+
22
+ /** @internal */
23
+ export const AudioChunkType$inboundSchema: z.ZodNativeEnum<
24
+ typeof AudioChunkType
25
+ > = z.nativeEnum(AudioChunkType);
26
+
27
+ /** @internal */
28
+ export const AudioChunkType$outboundSchema: z.ZodNativeEnum<
29
+ typeof AudioChunkType
30
+ > = AudioChunkType$inboundSchema;
31
+
32
+ /**
33
+ * @internal
34
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
35
+ */
36
+ export namespace AudioChunkType$ {
37
+ /** @deprecated use `AudioChunkType$inboundSchema` instead. */
38
+ export const inboundSchema = AudioChunkType$inboundSchema;
39
+ /** @deprecated use `AudioChunkType$outboundSchema` instead. */
40
+ export const outboundSchema = AudioChunkType$outboundSchema;
41
+ }
42
+
43
+ /** @internal */
44
+ export const AudioChunk$inboundSchema: z.ZodType<
45
+ AudioChunk,
46
+ z.ZodTypeDef,
47
+ unknown
48
+ > = z.object({
49
+ input_audio: z.string(),
50
+ type: AudioChunkType$inboundSchema.default("input_audio"),
51
+ }).transform((v) => {
52
+ return remap$(v, {
53
+ "input_audio": "inputAudio",
54
+ });
55
+ });
56
+
57
+ /** @internal */
58
+ export type AudioChunk$Outbound = {
59
+ input_audio: string;
60
+ type: string;
61
+ };
62
+
63
+ /** @internal */
64
+ export const AudioChunk$outboundSchema: z.ZodType<
65
+ AudioChunk$Outbound,
66
+ z.ZodTypeDef,
67
+ AudioChunk
68
+ > = z.object({
69
+ inputAudio: z.string(),
70
+ type: AudioChunkType$outboundSchema.default("input_audio"),
71
+ }).transform((v) => {
72
+ return remap$(v, {
73
+ inputAudio: "input_audio",
74
+ });
75
+ });
76
+
77
+ /**
78
+ * @internal
79
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
80
+ */
81
+ export namespace AudioChunk$ {
82
+ /** @deprecated use `AudioChunk$inboundSchema` instead. */
83
+ export const inboundSchema = AudioChunk$inboundSchema;
84
+ /** @deprecated use `AudioChunk$outboundSchema` instead. */
85
+ export const outboundSchema = AudioChunk$outboundSchema;
86
+ /** @deprecated use `AudioChunk$Outbound` instead. */
87
+ export type Outbound = AudioChunk$Outbound;
88
+ }
89
+
90
+ export function audioChunkToJSON(audioChunk: AudioChunk): string {
91
+ return JSON.stringify(AudioChunk$outboundSchema.parse(audioChunk));
92
+ }
93
+
94
+ export function audioChunkFromJSON(
95
+ jsonString: string,
96
+ ): SafeParseResult<AudioChunk, SDKValidationError> {
97
+ return safeParse(
98
+ jsonString,
99
+ (x) => AudioChunk$inboundSchema.parse(JSON.parse(x)),
100
+ `Failed to parse 'AudioChunk' from JSON`,
101
+ );
102
+ }
@@ -0,0 +1,133 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { blobLikeSchema } from "../../types/blobs.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+ import {
12
+ FileT,
13
+ FileT$inboundSchema,
14
+ FileT$Outbound,
15
+ FileT$outboundSchema,
16
+ } from "./file.js";
17
+ import {
18
+ TimestampGranularity,
19
+ TimestampGranularity$inboundSchema,
20
+ TimestampGranularity$outboundSchema,
21
+ } from "./timestampgranularity.js";
22
+
23
+ export type AudioTranscriptionRequest = {
24
+ model: string;
25
+ file?: FileT | Blob | undefined;
26
+ /**
27
+ * ID of a file uploaded to /v1/files
28
+ */
29
+ fileId?: string | null | undefined;
30
+ /**
31
+ * Url of a file to be transcribed
32
+ */
33
+ fileUrl?: string | null | undefined;
34
+ /**
35
+ * Language of the audio, e.g. 'en'. Providing the language can boost accuracy.
36
+ */
37
+ language?: string | null | undefined;
38
+ stream?: false | undefined;
39
+ temperature?: number | null | undefined;
40
+ /**
41
+ * Granularities of timestamps to include in the response.
42
+ */
43
+ timestampGranularities?: Array<TimestampGranularity> | undefined;
44
+ };
45
+
46
+ /** @internal */
47
+ export const AudioTranscriptionRequest$inboundSchema: z.ZodType<
48
+ AudioTranscriptionRequest,
49
+ z.ZodTypeDef,
50
+ unknown
51
+ > = z.object({
52
+ model: z.string(),
53
+ file: FileT$inboundSchema.optional(),
54
+ file_id: z.nullable(z.string()).optional(),
55
+ file_url: z.nullable(z.string()).optional(),
56
+ language: z.nullable(z.string()).optional(),
57
+ stream: z.literal(false).default(false),
58
+ temperature: z.nullable(z.number()).optional(),
59
+ timestamp_granularities: z.array(TimestampGranularity$inboundSchema)
60
+ .optional(),
61
+ }).transform((v) => {
62
+ return remap$(v, {
63
+ "file_id": "fileId",
64
+ "file_url": "fileUrl",
65
+ "timestamp_granularities": "timestampGranularities",
66
+ });
67
+ });
68
+
69
+ /** @internal */
70
+ export type AudioTranscriptionRequest$Outbound = {
71
+ model: string;
72
+ file?: FileT$Outbound | Blob | undefined;
73
+ file_id?: string | null | undefined;
74
+ file_url?: string | null | undefined;
75
+ language?: string | null | undefined;
76
+ stream: false;
77
+ temperature?: number | null | undefined;
78
+ timestamp_granularities?: Array<string> | undefined;
79
+ };
80
+
81
+ /** @internal */
82
+ export const AudioTranscriptionRequest$outboundSchema: z.ZodType<
83
+ AudioTranscriptionRequest$Outbound,
84
+ z.ZodTypeDef,
85
+ AudioTranscriptionRequest
86
+ > = z.object({
87
+ model: z.string(),
88
+ file: FileT$outboundSchema.or(blobLikeSchema).optional(),
89
+ fileId: z.nullable(z.string()).optional(),
90
+ fileUrl: z.nullable(z.string()).optional(),
91
+ language: z.nullable(z.string()).optional(),
92
+ stream: z.literal(false).default(false as const),
93
+ temperature: z.nullable(z.number()).optional(),
94
+ timestampGranularities: z.array(TimestampGranularity$outboundSchema)
95
+ .optional(),
96
+ }).transform((v) => {
97
+ return remap$(v, {
98
+ fileId: "file_id",
99
+ fileUrl: "file_url",
100
+ timestampGranularities: "timestamp_granularities",
101
+ });
102
+ });
103
+
104
+ /**
105
+ * @internal
106
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
107
+ */
108
+ export namespace AudioTranscriptionRequest$ {
109
+ /** @deprecated use `AudioTranscriptionRequest$inboundSchema` instead. */
110
+ export const inboundSchema = AudioTranscriptionRequest$inboundSchema;
111
+ /** @deprecated use `AudioTranscriptionRequest$outboundSchema` instead. */
112
+ export const outboundSchema = AudioTranscriptionRequest$outboundSchema;
113
+ /** @deprecated use `AudioTranscriptionRequest$Outbound` instead. */
114
+ export type Outbound = AudioTranscriptionRequest$Outbound;
115
+ }
116
+
117
+ export function audioTranscriptionRequestToJSON(
118
+ audioTranscriptionRequest: AudioTranscriptionRequest,
119
+ ): string {
120
+ return JSON.stringify(
121
+ AudioTranscriptionRequest$outboundSchema.parse(audioTranscriptionRequest),
122
+ );
123
+ }
124
+
125
+ export function audioTranscriptionRequestFromJSON(
126
+ jsonString: string,
127
+ ): SafeParseResult<AudioTranscriptionRequest, SDKValidationError> {
128
+ return safeParse(
129
+ jsonString,
130
+ (x) => AudioTranscriptionRequest$inboundSchema.parse(JSON.parse(x)),
131
+ `Failed to parse 'AudioTranscriptionRequest' from JSON`,
132
+ );
133
+ }