@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
@@ -47,7 +47,9 @@ export type RetrieveFileOut = {
47
47
  purpose: FilePurpose;
48
48
  sampleType: SampleType;
49
49
  numLines?: number | null | undefined;
50
+ mimetype?: string | null | undefined;
50
51
  source: Source;
52
+ signature?: string | null | undefined;
51
53
  deleted: boolean;
52
54
  };
53
55
 
@@ -65,7 +67,9 @@ export const RetrieveFileOut$inboundSchema: z.ZodType<
65
67
  purpose: FilePurpose$inboundSchema,
66
68
  sample_type: SampleType$inboundSchema,
67
69
  num_lines: z.nullable(z.number().int()).optional(),
70
+ mimetype: z.nullable(z.string()).optional(),
68
71
  source: Source$inboundSchema,
72
+ signature: z.nullable(z.string()).optional(),
69
73
  deleted: z.boolean(),
70
74
  }).transform((v) => {
71
75
  return remap$(v, {
@@ -86,7 +90,9 @@ export type RetrieveFileOut$Outbound = {
86
90
  purpose: string;
87
91
  sample_type: string;
88
92
  num_lines?: number | null | undefined;
93
+ mimetype?: string | null | undefined;
89
94
  source: string;
95
+ signature?: string | null | undefined;
90
96
  deleted: boolean;
91
97
  };
92
98
 
@@ -104,7 +110,9 @@ export const RetrieveFileOut$outboundSchema: z.ZodType<
104
110
  purpose: FilePurpose$outboundSchema,
105
111
  sampleType: SampleType$outboundSchema,
106
112
  numLines: z.nullable(z.number().int()).optional(),
113
+ mimetype: z.nullable(z.string()).optional(),
107
114
  source: Source$outboundSchema,
115
+ signature: z.nullable(z.string()).optional(),
108
116
  deleted: z.boolean(),
109
117
  }).transform((v) => {
110
118
  return remap$(v, {
@@ -0,0 +1,162 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { ClosedEnum } from "../../types/enums.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ ReferenceChunk,
12
+ ReferenceChunk$inboundSchema,
13
+ ReferenceChunk$Outbound,
14
+ ReferenceChunk$outboundSchema,
15
+ } from "./referencechunk.js";
16
+ import {
17
+ TextChunk,
18
+ TextChunk$inboundSchema,
19
+ TextChunk$Outbound,
20
+ TextChunk$outboundSchema,
21
+ } from "./textchunk.js";
22
+
23
+ export type Thinking = ReferenceChunk | TextChunk;
24
+
25
+ export const ThinkChunkType = {
26
+ Thinking: "thinking",
27
+ } as const;
28
+ export type ThinkChunkType = ClosedEnum<typeof ThinkChunkType>;
29
+
30
+ export type ThinkChunk = {
31
+ thinking: Array<ReferenceChunk | TextChunk>;
32
+ /**
33
+ * Whether the thinking chunk is closed or not. Currently only used for prefixing.
34
+ */
35
+ closed?: boolean | undefined;
36
+ type?: ThinkChunkType | undefined;
37
+ };
38
+
39
+ /** @internal */
40
+ export const Thinking$inboundSchema: z.ZodType<
41
+ Thinking,
42
+ z.ZodTypeDef,
43
+ unknown
44
+ > = z.union([ReferenceChunk$inboundSchema, TextChunk$inboundSchema]);
45
+
46
+ /** @internal */
47
+ export type Thinking$Outbound = ReferenceChunk$Outbound | TextChunk$Outbound;
48
+
49
+ /** @internal */
50
+ export const Thinking$outboundSchema: z.ZodType<
51
+ Thinking$Outbound,
52
+ z.ZodTypeDef,
53
+ Thinking
54
+ > = z.union([ReferenceChunk$outboundSchema, TextChunk$outboundSchema]);
55
+
56
+ /**
57
+ * @internal
58
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
59
+ */
60
+ export namespace Thinking$ {
61
+ /** @deprecated use `Thinking$inboundSchema` instead. */
62
+ export const inboundSchema = Thinking$inboundSchema;
63
+ /** @deprecated use `Thinking$outboundSchema` instead. */
64
+ export const outboundSchema = Thinking$outboundSchema;
65
+ /** @deprecated use `Thinking$Outbound` instead. */
66
+ export type Outbound = Thinking$Outbound;
67
+ }
68
+
69
+ export function thinkingToJSON(thinking: Thinking): string {
70
+ return JSON.stringify(Thinking$outboundSchema.parse(thinking));
71
+ }
72
+
73
+ export function thinkingFromJSON(
74
+ jsonString: string,
75
+ ): SafeParseResult<Thinking, SDKValidationError> {
76
+ return safeParse(
77
+ jsonString,
78
+ (x) => Thinking$inboundSchema.parse(JSON.parse(x)),
79
+ `Failed to parse 'Thinking' from JSON`,
80
+ );
81
+ }
82
+
83
+ /** @internal */
84
+ export const ThinkChunkType$inboundSchema: z.ZodNativeEnum<
85
+ typeof ThinkChunkType
86
+ > = z.nativeEnum(ThinkChunkType);
87
+
88
+ /** @internal */
89
+ export const ThinkChunkType$outboundSchema: z.ZodNativeEnum<
90
+ typeof ThinkChunkType
91
+ > = ThinkChunkType$inboundSchema;
92
+
93
+ /**
94
+ * @internal
95
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
96
+ */
97
+ export namespace ThinkChunkType$ {
98
+ /** @deprecated use `ThinkChunkType$inboundSchema` instead. */
99
+ export const inboundSchema = ThinkChunkType$inboundSchema;
100
+ /** @deprecated use `ThinkChunkType$outboundSchema` instead. */
101
+ export const outboundSchema = ThinkChunkType$outboundSchema;
102
+ }
103
+
104
+ /** @internal */
105
+ export const ThinkChunk$inboundSchema: z.ZodType<
106
+ ThinkChunk,
107
+ z.ZodTypeDef,
108
+ unknown
109
+ > = z.object({
110
+ thinking: z.array(
111
+ z.union([ReferenceChunk$inboundSchema, TextChunk$inboundSchema]),
112
+ ),
113
+ closed: z.boolean().optional(),
114
+ type: ThinkChunkType$inboundSchema.default("thinking"),
115
+ });
116
+
117
+ /** @internal */
118
+ export type ThinkChunk$Outbound = {
119
+ thinking: Array<ReferenceChunk$Outbound | TextChunk$Outbound>;
120
+ closed?: boolean | undefined;
121
+ type: string;
122
+ };
123
+
124
+ /** @internal */
125
+ export const ThinkChunk$outboundSchema: z.ZodType<
126
+ ThinkChunk$Outbound,
127
+ z.ZodTypeDef,
128
+ ThinkChunk
129
+ > = z.object({
130
+ thinking: z.array(
131
+ z.union([ReferenceChunk$outboundSchema, TextChunk$outboundSchema]),
132
+ ),
133
+ closed: z.boolean().optional(),
134
+ type: ThinkChunkType$outboundSchema.default("thinking"),
135
+ });
136
+
137
+ /**
138
+ * @internal
139
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
140
+ */
141
+ export namespace ThinkChunk$ {
142
+ /** @deprecated use `ThinkChunk$inboundSchema` instead. */
143
+ export const inboundSchema = ThinkChunk$inboundSchema;
144
+ /** @deprecated use `ThinkChunk$outboundSchema` instead. */
145
+ export const outboundSchema = ThinkChunk$outboundSchema;
146
+ /** @deprecated use `ThinkChunk$Outbound` instead. */
147
+ export type Outbound = ThinkChunk$Outbound;
148
+ }
149
+
150
+ export function thinkChunkToJSON(thinkChunk: ThinkChunk): string {
151
+ return JSON.stringify(ThinkChunk$outboundSchema.parse(thinkChunk));
152
+ }
153
+
154
+ export function thinkChunkFromJSON(
155
+ jsonString: string,
156
+ ): SafeParseResult<ThinkChunk, SDKValidationError> {
157
+ return safeParse(
158
+ jsonString,
159
+ (x) => ThinkChunk$inboundSchema.parse(JSON.parse(x)),
160
+ `Failed to parse 'ThinkChunk' from JSON`,
161
+ );
162
+ }
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { ClosedEnum } from "../../types/enums.js";
7
+
8
+ export const TimestampGranularity = {
9
+ Segment: "segment",
10
+ } as const;
11
+ export type TimestampGranularity = ClosedEnum<typeof TimestampGranularity>;
12
+
13
+ /** @internal */
14
+ export const TimestampGranularity$inboundSchema: z.ZodNativeEnum<
15
+ typeof TimestampGranularity
16
+ > = z.nativeEnum(TimestampGranularity);
17
+
18
+ /** @internal */
19
+ export const TimestampGranularity$outboundSchema: z.ZodNativeEnum<
20
+ typeof TimestampGranularity
21
+ > = TimestampGranularity$inboundSchema;
22
+
23
+ /**
24
+ * @internal
25
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
26
+ */
27
+ export namespace TimestampGranularity$ {
28
+ /** @deprecated use `TimestampGranularity$inboundSchema` instead. */
29
+ export const inboundSchema = TimestampGranularity$inboundSchema;
30
+ /** @deprecated use `TimestampGranularity$outboundSchema` instead. */
31
+ export const outboundSchema = TimestampGranularity$outboundSchema;
32
+ }
@@ -0,0 +1,112 @@
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 {
8
+ collectExtraKeys as collectExtraKeys$,
9
+ safeParse,
10
+ } from "../../lib/schemas.js";
11
+ import { Result as SafeParseResult } from "../../types/fp.js";
12
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
13
+ import {
14
+ TranscriptionSegmentChunk,
15
+ TranscriptionSegmentChunk$inboundSchema,
16
+ TranscriptionSegmentChunk$Outbound,
17
+ TranscriptionSegmentChunk$outboundSchema,
18
+ } from "./transcriptionsegmentchunk.js";
19
+ import {
20
+ UsageInfo,
21
+ UsageInfo$inboundSchema,
22
+ UsageInfo$Outbound,
23
+ UsageInfo$outboundSchema,
24
+ } from "./usageinfo.js";
25
+
26
+ export type TranscriptionResponse = {
27
+ model: string;
28
+ text: string;
29
+ segments?: Array<TranscriptionSegmentChunk> | undefined;
30
+ usage: UsageInfo;
31
+ language: string | null;
32
+ additionalProperties?: { [k: string]: any };
33
+ };
34
+
35
+ /** @internal */
36
+ export const TranscriptionResponse$inboundSchema: z.ZodType<
37
+ TranscriptionResponse,
38
+ z.ZodTypeDef,
39
+ unknown
40
+ > = collectExtraKeys$(
41
+ z.object({
42
+ model: z.string(),
43
+ text: z.string(),
44
+ segments: z.array(TranscriptionSegmentChunk$inboundSchema).optional(),
45
+ usage: UsageInfo$inboundSchema,
46
+ language: z.nullable(z.string()),
47
+ }).catchall(z.any()),
48
+ "additionalProperties",
49
+ true,
50
+ );
51
+
52
+ /** @internal */
53
+ export type TranscriptionResponse$Outbound = {
54
+ model: string;
55
+ text: string;
56
+ segments?: Array<TranscriptionSegmentChunk$Outbound> | undefined;
57
+ usage: UsageInfo$Outbound;
58
+ language: string | null;
59
+ [additionalProperties: string]: unknown;
60
+ };
61
+
62
+ /** @internal */
63
+ export const TranscriptionResponse$outboundSchema: z.ZodType<
64
+ TranscriptionResponse$Outbound,
65
+ z.ZodTypeDef,
66
+ TranscriptionResponse
67
+ > = z.object({
68
+ model: z.string(),
69
+ text: z.string(),
70
+ segments: z.array(TranscriptionSegmentChunk$outboundSchema).optional(),
71
+ usage: UsageInfo$outboundSchema,
72
+ language: z.nullable(z.string()),
73
+ additionalProperties: z.record(z.any()),
74
+ }).transform((v) => {
75
+ return {
76
+ ...v.additionalProperties,
77
+ ...remap$(v, {
78
+ additionalProperties: null,
79
+ }),
80
+ };
81
+ });
82
+
83
+ /**
84
+ * @internal
85
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
86
+ */
87
+ export namespace TranscriptionResponse$ {
88
+ /** @deprecated use `TranscriptionResponse$inboundSchema` instead. */
89
+ export const inboundSchema = TranscriptionResponse$inboundSchema;
90
+ /** @deprecated use `TranscriptionResponse$outboundSchema` instead. */
91
+ export const outboundSchema = TranscriptionResponse$outboundSchema;
92
+ /** @deprecated use `TranscriptionResponse$Outbound` instead. */
93
+ export type Outbound = TranscriptionResponse$Outbound;
94
+ }
95
+
96
+ export function transcriptionResponseToJSON(
97
+ transcriptionResponse: TranscriptionResponse,
98
+ ): string {
99
+ return JSON.stringify(
100
+ TranscriptionResponse$outboundSchema.parse(transcriptionResponse),
101
+ );
102
+ }
103
+
104
+ export function transcriptionResponseFromJSON(
105
+ jsonString: string,
106
+ ): SafeParseResult<TranscriptionResponse, SDKValidationError> {
107
+ return safeParse(
108
+ jsonString,
109
+ (x) => TranscriptionResponse$inboundSchema.parse(JSON.parse(x)),
110
+ `Failed to parse 'TranscriptionResponse' from JSON`,
111
+ );
112
+ }
@@ -0,0 +1,122 @@
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 {
8
+ collectExtraKeys as collectExtraKeys$,
9
+ safeParse,
10
+ } from "../../lib/schemas.js";
11
+ import { ClosedEnum } from "../../types/enums.js";
12
+ import { Result as SafeParseResult } from "../../types/fp.js";
13
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
14
+
15
+ export const Type = {
16
+ TranscriptionSegment: "transcription_segment",
17
+ } as const;
18
+ export type Type = ClosedEnum<typeof Type>;
19
+
20
+ export type TranscriptionSegmentChunk = {
21
+ text: string;
22
+ start: number;
23
+ end: number;
24
+ type?: Type | undefined;
25
+ additionalProperties?: { [k: string]: any };
26
+ };
27
+
28
+ /** @internal */
29
+ export const Type$inboundSchema: z.ZodNativeEnum<typeof Type> = z.nativeEnum(
30
+ Type,
31
+ );
32
+
33
+ /** @internal */
34
+ export const Type$outboundSchema: z.ZodNativeEnum<typeof Type> =
35
+ Type$inboundSchema;
36
+
37
+ /**
38
+ * @internal
39
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
40
+ */
41
+ export namespace Type$ {
42
+ /** @deprecated use `Type$inboundSchema` instead. */
43
+ export const inboundSchema = Type$inboundSchema;
44
+ /** @deprecated use `Type$outboundSchema` instead. */
45
+ export const outboundSchema = Type$outboundSchema;
46
+ }
47
+
48
+ /** @internal */
49
+ export const TranscriptionSegmentChunk$inboundSchema: z.ZodType<
50
+ TranscriptionSegmentChunk,
51
+ z.ZodTypeDef,
52
+ unknown
53
+ > = collectExtraKeys$(
54
+ z.object({
55
+ text: z.string(),
56
+ start: z.number(),
57
+ end: z.number(),
58
+ type: Type$inboundSchema.default("transcription_segment"),
59
+ }).catchall(z.any()),
60
+ "additionalProperties",
61
+ true,
62
+ );
63
+
64
+ /** @internal */
65
+ export type TranscriptionSegmentChunk$Outbound = {
66
+ text: string;
67
+ start: number;
68
+ end: number;
69
+ type: string;
70
+ [additionalProperties: string]: unknown;
71
+ };
72
+
73
+ /** @internal */
74
+ export const TranscriptionSegmentChunk$outboundSchema: z.ZodType<
75
+ TranscriptionSegmentChunk$Outbound,
76
+ z.ZodTypeDef,
77
+ TranscriptionSegmentChunk
78
+ > = z.object({
79
+ text: z.string(),
80
+ start: z.number(),
81
+ end: z.number(),
82
+ type: Type$outboundSchema.default("transcription_segment"),
83
+ additionalProperties: z.record(z.any()),
84
+ }).transform((v) => {
85
+ return {
86
+ ...v.additionalProperties,
87
+ ...remap$(v, {
88
+ additionalProperties: null,
89
+ }),
90
+ };
91
+ });
92
+
93
+ /**
94
+ * @internal
95
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
96
+ */
97
+ export namespace TranscriptionSegmentChunk$ {
98
+ /** @deprecated use `TranscriptionSegmentChunk$inboundSchema` instead. */
99
+ export const inboundSchema = TranscriptionSegmentChunk$inboundSchema;
100
+ /** @deprecated use `TranscriptionSegmentChunk$outboundSchema` instead. */
101
+ export const outboundSchema = TranscriptionSegmentChunk$outboundSchema;
102
+ /** @deprecated use `TranscriptionSegmentChunk$Outbound` instead. */
103
+ export type Outbound = TranscriptionSegmentChunk$Outbound;
104
+ }
105
+
106
+ export function transcriptionSegmentChunkToJSON(
107
+ transcriptionSegmentChunk: TranscriptionSegmentChunk,
108
+ ): string {
109
+ return JSON.stringify(
110
+ TranscriptionSegmentChunk$outboundSchema.parse(transcriptionSegmentChunk),
111
+ );
112
+ }
113
+
114
+ export function transcriptionSegmentChunkFromJSON(
115
+ jsonString: string,
116
+ ): SafeParseResult<TranscriptionSegmentChunk, SDKValidationError> {
117
+ return safeParse(
118
+ jsonString,
119
+ (x) => TranscriptionSegmentChunk$inboundSchema.parse(JSON.parse(x)),
120
+ `Failed to parse 'TranscriptionSegmentChunk' from JSON`,
121
+ );
122
+ }
@@ -0,0 +1,149 @@
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 {
8
+ collectExtraKeys as collectExtraKeys$,
9
+ safeParse,
10
+ } from "../../lib/schemas.js";
11
+ import { ClosedEnum } from "../../types/enums.js";
12
+ import { Result as SafeParseResult } from "../../types/fp.js";
13
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
14
+ import {
15
+ TranscriptionSegmentChunk,
16
+ TranscriptionSegmentChunk$inboundSchema,
17
+ TranscriptionSegmentChunk$Outbound,
18
+ TranscriptionSegmentChunk$outboundSchema,
19
+ } from "./transcriptionsegmentchunk.js";
20
+ import {
21
+ UsageInfo,
22
+ UsageInfo$inboundSchema,
23
+ UsageInfo$Outbound,
24
+ UsageInfo$outboundSchema,
25
+ } from "./usageinfo.js";
26
+
27
+ export const TranscriptionStreamDoneType = {
28
+ TranscriptionDone: "transcription.done",
29
+ } as const;
30
+ export type TranscriptionStreamDoneType = ClosedEnum<
31
+ typeof TranscriptionStreamDoneType
32
+ >;
33
+
34
+ export type TranscriptionStreamDone = {
35
+ model: string;
36
+ text: string;
37
+ segments?: Array<TranscriptionSegmentChunk> | undefined;
38
+ usage: UsageInfo;
39
+ type?: TranscriptionStreamDoneType | undefined;
40
+ language: string | null;
41
+ additionalProperties?: { [k: string]: any };
42
+ };
43
+
44
+ /** @internal */
45
+ export const TranscriptionStreamDoneType$inboundSchema: z.ZodNativeEnum<
46
+ typeof TranscriptionStreamDoneType
47
+ > = z.nativeEnum(TranscriptionStreamDoneType);
48
+
49
+ /** @internal */
50
+ export const TranscriptionStreamDoneType$outboundSchema: z.ZodNativeEnum<
51
+ typeof TranscriptionStreamDoneType
52
+ > = TranscriptionStreamDoneType$inboundSchema;
53
+
54
+ /**
55
+ * @internal
56
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
57
+ */
58
+ export namespace TranscriptionStreamDoneType$ {
59
+ /** @deprecated use `TranscriptionStreamDoneType$inboundSchema` instead. */
60
+ export const inboundSchema = TranscriptionStreamDoneType$inboundSchema;
61
+ /** @deprecated use `TranscriptionStreamDoneType$outboundSchema` instead. */
62
+ export const outboundSchema = TranscriptionStreamDoneType$outboundSchema;
63
+ }
64
+
65
+ /** @internal */
66
+ export const TranscriptionStreamDone$inboundSchema: z.ZodType<
67
+ TranscriptionStreamDone,
68
+ z.ZodTypeDef,
69
+ unknown
70
+ > = collectExtraKeys$(
71
+ z.object({
72
+ model: z.string(),
73
+ text: z.string(),
74
+ segments: z.array(TranscriptionSegmentChunk$inboundSchema).optional(),
75
+ usage: UsageInfo$inboundSchema,
76
+ type: TranscriptionStreamDoneType$inboundSchema.default(
77
+ "transcription.done",
78
+ ),
79
+ language: z.nullable(z.string()),
80
+ }).catchall(z.any()),
81
+ "additionalProperties",
82
+ true,
83
+ );
84
+
85
+ /** @internal */
86
+ export type TranscriptionStreamDone$Outbound = {
87
+ model: string;
88
+ text: string;
89
+ segments?: Array<TranscriptionSegmentChunk$Outbound> | undefined;
90
+ usage: UsageInfo$Outbound;
91
+ type: string;
92
+ language: string | null;
93
+ [additionalProperties: string]: unknown;
94
+ };
95
+
96
+ /** @internal */
97
+ export const TranscriptionStreamDone$outboundSchema: z.ZodType<
98
+ TranscriptionStreamDone$Outbound,
99
+ z.ZodTypeDef,
100
+ TranscriptionStreamDone
101
+ > = z.object({
102
+ model: z.string(),
103
+ text: z.string(),
104
+ segments: z.array(TranscriptionSegmentChunk$outboundSchema).optional(),
105
+ usage: UsageInfo$outboundSchema,
106
+ type: TranscriptionStreamDoneType$outboundSchema.default(
107
+ "transcription.done",
108
+ ),
109
+ language: z.nullable(z.string()),
110
+ additionalProperties: z.record(z.any()),
111
+ }).transform((v) => {
112
+ return {
113
+ ...v.additionalProperties,
114
+ ...remap$(v, {
115
+ additionalProperties: null,
116
+ }),
117
+ };
118
+ });
119
+
120
+ /**
121
+ * @internal
122
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
123
+ */
124
+ export namespace TranscriptionStreamDone$ {
125
+ /** @deprecated use `TranscriptionStreamDone$inboundSchema` instead. */
126
+ export const inboundSchema = TranscriptionStreamDone$inboundSchema;
127
+ /** @deprecated use `TranscriptionStreamDone$outboundSchema` instead. */
128
+ export const outboundSchema = TranscriptionStreamDone$outboundSchema;
129
+ /** @deprecated use `TranscriptionStreamDone$Outbound` instead. */
130
+ export type Outbound = TranscriptionStreamDone$Outbound;
131
+ }
132
+
133
+ export function transcriptionStreamDoneToJSON(
134
+ transcriptionStreamDone: TranscriptionStreamDone,
135
+ ): string {
136
+ return JSON.stringify(
137
+ TranscriptionStreamDone$outboundSchema.parse(transcriptionStreamDone),
138
+ );
139
+ }
140
+
141
+ export function transcriptionStreamDoneFromJSON(
142
+ jsonString: string,
143
+ ): SafeParseResult<TranscriptionStreamDone, SDKValidationError> {
144
+ return safeParse(
145
+ jsonString,
146
+ (x) => TranscriptionStreamDone$inboundSchema.parse(JSON.parse(x)),
147
+ `Failed to parse 'TranscriptionStreamDone' from JSON`,
148
+ );
149
+ }