@mistralai/mistralai 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/esm/extra/realtime/connection.d.ts +16 -3
  2. package/esm/extra/realtime/connection.d.ts.map +1 -1
  3. package/esm/extra/realtime/connection.js +35 -9
  4. package/esm/extra/realtime/connection.js.map +1 -1
  5. package/esm/extra/realtime/errors.d.ts +18 -0
  6. package/esm/extra/realtime/errors.d.ts.map +1 -1
  7. package/esm/extra/realtime/errors.js +19 -0
  8. package/esm/extra/realtime/errors.js.map +1 -1
  9. package/esm/extra/realtime/index.d.ts +20 -1
  10. package/esm/extra/realtime/index.d.ts.map +1 -1
  11. package/esm/extra/realtime/index.js +5 -0
  12. package/esm/extra/realtime/index.js.map +1 -1
  13. package/esm/extra/realtime/speech.d.ts +64 -0
  14. package/esm/extra/realtime/speech.d.ts.map +1 -0
  15. package/esm/extra/realtime/speech.js +461 -0
  16. package/esm/extra/realtime/speech.js.map +1 -0
  17. package/esm/extra/realtime/transcription.d.ts +2 -2
  18. package/esm/extra/realtime/transcription.d.ts.map +1 -1
  19. package/esm/extra/realtime/transcription.js +11 -2
  20. package/esm/extra/realtime/transcription.js.map +1 -1
  21. package/esm/extra/workflows/encoding/payload-encoder.d.ts.map +1 -1
  22. package/esm/extra/workflows/encoding/payload-encoder.js +2 -2
  23. package/esm/extra/workflows/encoding/payload-encoder.js.map +1 -1
  24. package/esm/extra/workflows/encoding/python-json.d.ts +3 -2
  25. package/esm/extra/workflows/encoding/python-json.d.ts.map +1 -1
  26. package/esm/extra/workflows/encoding/python-json.js +24 -9
  27. package/esm/extra/workflows/encoding/python-json.js.map +1 -1
  28. package/esm/funcs/betaRagManagedIndexesCreate.js +1 -1
  29. package/esm/funcs/betaRagManagedIndexesCreate.js.map +1 -1
  30. package/esm/lib/config.d.ts +2 -2
  31. package/esm/lib/config.js +2 -2
  32. package/esm/models/components/connectionpreference.d.ts +12 -2
  33. package/esm/models/components/connectionpreference.d.ts.map +1 -1
  34. package/esm/models/components/connectionpreference.js +3 -3
  35. package/esm/models/components/connectionpreference.js.map +1 -1
  36. package/esm/models/components/index.d.ts +11 -5
  37. package/esm/models/components/index.d.ts.map +1 -1
  38. package/esm/models/components/index.js +11 -5
  39. package/esm/models/components/index.js.map +1 -1
  40. package/esm/models/components/observabilityerrorcode.d.ts +1 -0
  41. package/esm/models/components/observabilityerrorcode.d.ts.map +1 -1
  42. package/esm/models/components/observabilityerrorcode.js +1 -0
  43. package/esm/models/components/observabilityerrorcode.js.map +1 -1
  44. package/esm/models/components/realtimespeecherror.d.ts +20 -0
  45. package/esm/models/components/realtimespeecherror.d.ts.map +1 -0
  46. package/esm/models/components/realtimespeecherror.js +23 -0
  47. package/esm/models/components/realtimespeecherror.js.map +1 -0
  48. package/esm/models/components/realtimespeecherrordetail.d.ts +45 -0
  49. package/esm/models/components/realtimespeecherrordetail.d.ts.map +1 -0
  50. package/esm/models/components/realtimespeecherrordetail.js +33 -0
  51. package/esm/models/components/realtimespeecherrordetail.js.map +1 -0
  52. package/esm/models/components/realtimespeechinputtextappend.d.ts +19 -0
  53. package/esm/models/components/realtimespeechinputtextappend.d.ts.map +1 -0
  54. package/esm/models/components/realtimespeechinputtextappend.js +22 -0
  55. package/esm/models/components/realtimespeechinputtextappend.js.map +1 -0
  56. package/esm/models/components/realtimespeechinputtextend.d.ts +17 -0
  57. package/esm/models/components/realtimespeechinputtextend.d.ts.map +1 -0
  58. package/esm/models/components/realtimespeechinputtextend.js +20 -0
  59. package/esm/models/components/realtimespeechinputtextend.js.map +1 -0
  60. package/esm/models/components/realtimespeechinputtextflush.d.ts +19 -0
  61. package/esm/models/components/realtimespeechinputtextflush.d.ts.map +1 -0
  62. package/esm/models/components/realtimespeechinputtextflush.js +22 -0
  63. package/esm/models/components/realtimespeechinputtextflush.js.map +1 -0
  64. package/esm/models/components/realtimespeechsession.d.ts +31 -0
  65. package/esm/models/components/realtimespeechsession.d.ts.map +1 -0
  66. package/esm/models/components/realtimespeechsession.js +49 -0
  67. package/esm/models/components/realtimespeechsession.js.map +1 -0
  68. package/esm/models/components/realtimespeechsessioncreated.d.ts +20 -0
  69. package/esm/models/components/realtimespeechsessioncreated.d.ts.map +1 -0
  70. package/esm/models/components/realtimespeechsessioncreated.js +23 -0
  71. package/esm/models/components/realtimespeechsessioncreated.js.map +1 -0
  72. package/esm/models/components/realtimespeechsessionupdated.d.ts +20 -0
  73. package/esm/models/components/realtimespeechsessionupdated.d.ts.map +1 -0
  74. package/esm/models/components/realtimespeechsessionupdated.js +23 -0
  75. package/esm/models/components/realtimespeechsessionupdated.js.map +1 -0
  76. package/esm/models/components/realtimespeechsessionupdatemessage.d.ts +20 -0
  77. package/esm/models/components/realtimespeechsessionupdatemessage.d.ts.map +1 -0
  78. package/esm/models/components/realtimespeechsessionupdatemessage.js +23 -0
  79. package/esm/models/components/realtimespeechsessionupdatemessage.js.map +1 -0
  80. package/esm/models/components/realtimespeechsessionupdatepayload.d.ts +42 -0
  81. package/esm/models/components/realtimespeechsessionupdatepayload.d.ts.map +1 -0
  82. package/esm/models/components/realtimespeechsessionupdatepayload.js +45 -0
  83. package/esm/models/components/realtimespeechsessionupdatepayload.js.map +1 -0
  84. package/esm/models/components/realtimespeechstreamingmode.d.ts +12 -0
  85. package/esm/models/components/realtimespeechstreamingmode.d.ts.map +1 -0
  86. package/esm/models/components/realtimespeechstreamingmode.js +13 -0
  87. package/esm/models/components/realtimespeechstreamingmode.js.map +1 -0
  88. package/esm/models/components/reasoningeffort.d.ts +1 -0
  89. package/esm/models/components/reasoningeffort.d.ts.map +1 -1
  90. package/esm/models/components/reasoningeffort.js +1 -0
  91. package/esm/models/components/reasoningeffort.js.map +1 -1
  92. package/esm/models/components/speechoutputformat.d.ts +2 -0
  93. package/esm/models/components/speechoutputformat.d.ts.map +1 -1
  94. package/esm/models/components/speechoutputformat.js +3 -1
  95. package/esm/models/components/speechoutputformat.js.map +1 -1
  96. package/esm/models/components/speechstreamaudiodelta.d.ts +8 -0
  97. package/esm/models/components/speechstreamaudiodelta.d.ts.map +1 -1
  98. package/esm/models/components/speechstreamaudiodelta.js +12 -0
  99. package/esm/models/components/speechstreamaudiodelta.js.map +1 -1
  100. package/esm/models/components/speechstreamdone.d.ts +10 -2
  101. package/esm/models/components/speechstreamdone.d.ts.map +1 -1
  102. package/esm/models/components/speechstreamdone.js +10 -2
  103. package/esm/models/components/speechstreamdone.js.map +1 -1
  104. package/jsr.json +1 -1
  105. package/package.json +11 -11
  106. package/src/extra/realtime/connection.ts +88 -13
  107. package/src/extra/realtime/errors.ts +32 -0
  108. package/src/extra/realtime/index.ts +42 -1
  109. package/src/extra/realtime/speech.ts +646 -0
  110. package/src/extra/realtime/transcription.ts +22 -9
  111. package/src/extra/workflows/encoding/payload-encoder.ts +2 -1
  112. package/src/extra/workflows/encoding/python-json.ts +34 -8
  113. package/src/funcs/betaRagManagedIndexesCreate.ts +1 -1
  114. package/src/lib/config.ts +2 -2
  115. package/src/models/components/connectionpreference.ts +15 -5
  116. package/src/models/components/index.ts +11 -5
  117. package/src/models/components/observabilityerrorcode.ts +2 -0
  118. package/src/models/components/realtimespeecherror.ts +59 -0
  119. package/src/models/components/realtimespeecherrordetail.ts +100 -0
  120. package/src/models/components/realtimespeechinputtextappend.ts +55 -0
  121. package/src/models/components/realtimespeechinputtextend.ts +49 -0
  122. package/src/models/components/realtimespeechinputtextflush.ts +55 -0
  123. package/src/models/components/realtimespeechsession.ts +98 -0
  124. package/src/models/components/realtimespeechsessioncreated.ts +61 -0
  125. package/src/models/components/realtimespeechsessionupdated.ts +61 -0
  126. package/src/models/components/realtimespeechsessionupdatemessage.ts +62 -0
  127. package/src/models/components/realtimespeechsessionupdatepayload.ts +108 -0
  128. package/src/models/components/realtimespeechstreamingmode.ts +23 -0
  129. package/src/models/components/reasoningeffort.ts +1 -0
  130. package/src/models/components/speechoutputformat.ts +5 -1
  131. package/src/models/components/speechstreamaudiodelta.ts +25 -0
  132. package/src/models/components/speechstreamdone.ts +28 -5
  133. package/tests/extra/realtime-speech-ws.test.ts +193 -0
  134. package/tests/extra/realtime-speech.test.ts +532 -0
  135. package/tests/extra/realtime.test.ts +217 -0
  136. package/tests/extra/workflow-encryption.test.ts +2 -2
  137. package/tests/hooks/workflow-encoding.test.ts +1 -1
  138. package/esm/models/components/completiontokensdetails.d.ts +0 -19
  139. package/esm/models/components/completiontokensdetails.d.ts.map +0 -1
  140. package/esm/models/components/completiontokensdetails.js +0 -18
  141. package/esm/models/components/completiontokensdetails.js.map +0 -1
  142. package/esm/models/components/messagetokens.d.ts +0 -18
  143. package/esm/models/components/messagetokens.d.ts.map +0 -1
  144. package/esm/models/components/messagetokens.js +0 -26
  145. package/esm/models/components/messagetokens.js.map +0 -1
  146. package/esm/models/components/prompttokensdetails.d.ts +0 -16
  147. package/esm/models/components/prompttokensdetails.d.ts.map +0 -1
  148. package/esm/models/components/prompttokensdetails.js +0 -22
  149. package/esm/models/components/prompttokensdetails.js.map +0 -1
  150. package/esm/models/components/roles.d.ts +0 -12
  151. package/esm/models/components/roles.d.ts.map +0 -1
  152. package/esm/models/components/roles.js +0 -14
  153. package/esm/models/components/roles.js.map +0 -1
  154. package/esm/models/components/usageinfodollardefs.d.ts +0 -24
  155. package/esm/models/components/usageinfodollardefs.d.ts.map +0 -1
  156. package/esm/models/components/usageinfodollardefs.js +0 -41
  157. package/esm/models/components/usageinfodollardefs.js.map +0 -1
  158. package/src/models/components/completiontokensdetails.ts +0 -44
  159. package/src/models/components/messagetokens.ts +0 -47
  160. package/src/models/components/prompttokensdetails.ts +0 -44
  161. package/src/models/components/roles.ts +0 -19
  162. package/src/models/components/usageinfodollardefs.ts +0 -76
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Byte-exact ports of the two JSON serializers the Python `PayloadEncoder`
2
+ * Byte-exact ports of the JSON serializers the Python `PayloadEncoder`
3
3
  * uses, so that encoded payloads match the Python client and workers:
4
4
  *
5
5
  * - `toJsonBytes` mirrors `pydantic_core.to_json`: compact, raw UTF-8. Python
6
6
  * uses it to serialize workflow inputs before encoding them.
7
7
  * - `parsePythonJson` + `dumpsPythonJson` mirror `json.loads` +
8
8
  * `json.dumps` with default arguments (", " / ": " separators, ASCII only).
9
- * Partial encryption re-serializes the whole payload this way. The parser
9
+ * Partial decryption re-serializes the whole payload this way. The parser
10
10
  * keeps key order and the int/float distinction of number tokens, which a
11
11
  * plain `JSON.parse` would lose.
12
12
  *
@@ -349,21 +349,47 @@ function formatNumberToken(raw: string): string {
349
349
  return formatPythonFloat(Number(raw));
350
350
  }
351
351
 
352
- function dumpsText(value: PythonJsonValue): string {
352
+ type DumpsStyle = {
353
+ quote: (value: string) => string;
354
+ itemSeparator: string;
355
+ keySeparator: string;
356
+ };
357
+
358
+ const DEFAULT_DUMPS_STYLE: DumpsStyle = {
359
+ quote: escapeAscii,
360
+ itemSeparator: ", ",
361
+ keySeparator: ": ",
362
+ };
363
+
364
+ const COMPACT_DUMPS_STYLE: DumpsStyle = {
365
+ quote: (value) => JSON.stringify(value),
366
+ itemSeparator: ",",
367
+ keySeparator: ":",
368
+ };
369
+
370
+ function dumpsText(value: PythonJsonValue, style: DumpsStyle): string {
353
371
  if (value === null) return "null";
354
372
  if (value === true) return "true";
355
373
  if (value === false) return "false";
356
- if (typeof value === "string") return escapeAscii(value);
374
+ if (typeof value === "string") return style.quote(value);
357
375
  if (value instanceof PythonJsonNumber) return formatNumberToken(value.raw);
358
- if (Array.isArray(value)) return `[${value.map(dumpsText).join(", ")}]`;
376
+ if (Array.isArray(value)) {
377
+ const items = value.map((item) => dumpsText(item, style));
378
+ return `[${items.join(style.itemSeparator)}]`;
379
+ }
359
380
  const members = Array.from(
360
381
  value,
361
- ([key, member]) => `${escapeAscii(key)}: ${dumpsText(member)}`,
382
+ ([key, member]) =>
383
+ `${style.quote(key)}${style.keySeparator}${dumpsText(member, style)}`,
362
384
  );
363
- return `{${members.join(", ")}}`;
385
+ return `{${members.join(style.itemSeparator)}}`;
364
386
  }
365
387
 
366
388
  /** Serializes a parsed value like Python's `json.dumps(obj).encode()`. */
367
389
  export function dumpsPythonJson(value: PythonJsonValue): Uint8Array {
368
- return textEncoder.encode(dumpsText(value));
390
+ return textEncoder.encode(dumpsText(value, DEFAULT_DUMPS_STYLE));
391
+ }
392
+
393
+ export function dumpsCompactPythonJson(value: PythonJsonValue): Uint8Array {
394
+ return textEncoder.encode(dumpsText(value, COMPACT_DUMPS_STYLE));
369
395
  }
@@ -165,7 +165,7 @@ async function $do(
165
165
  { hdrs: true, key: "Result" },
166
166
  ),
167
167
  M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
168
- M.fail([409, "4XX"]),
168
+ M.fail([403, 409, "4XX"]),
169
169
  M.fail("5XX"),
170
170
  )(response, req, { extraFields: responseFields });
171
171
  if (!result.ok) {
package/src/lib/config.ts CHANGED
@@ -69,8 +69,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
69
69
  export const SDK_METADATA = {
70
70
  language: "typescript",
71
71
  openapiDocVersion: "1.0.0",
72
- sdkVersion: "3.2.0",
72
+ sdkVersion: "3.4.0",
73
73
  genVersion: "2.935.1",
74
74
  userAgent:
75
- "speakeasy-sdk/typescript 3.2.0 2.935.1 1.0.0 @mistralai/mistralai",
75
+ "speakeasy-sdk/typescript 3.4.0 2.935.1 1.0.0 @mistralai/mistralai",
76
76
  } as const;
@@ -14,10 +14,20 @@ import {
14
14
  } from "./toolexecutionconfiguration.js";
15
15
 
16
16
  export type ConnectionPreference = {
17
- name: string;
18
17
  toolConfiguration: ToolExecutionConfiguration;
19
- isDefault?: boolean | null | undefined;
20
18
  consumerType?: ConsumerType | null | undefined;
19
+ /**
20
+ * Deprecated: always `default`, a connection holds a single preference.
21
+ *
22
+ * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
23
+ */
24
+ name: string;
25
+ /**
26
+ * Deprecated: always `true`.
27
+ *
28
+ * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
29
+ */
30
+ isDefault?: boolean | null | undefined;
21
31
  };
22
32
 
23
33
  /** @internal */
@@ -25,15 +35,15 @@ export const ConnectionPreference$inboundSchema: z.ZodType<
25
35
  ConnectionPreference,
26
36
  unknown
27
37
  > = z.object({
28
- name: z.string(),
29
38
  tool_configuration: ToolExecutionConfiguration$inboundSchema,
30
- is_default: z.nullable(z.boolean()).optional(),
31
39
  consumer_type: z.nullable(ConsumerType$inboundSchema).optional(),
40
+ name: z.string().default("default"),
41
+ is_default: z.nullable(z.boolean()).optional(),
32
42
  }).transform((v) => {
33
43
  return remap$(v, {
34
44
  "tool_configuration": "toolConfiguration",
35
- "is_default": "isDefault",
36
45
  "consumer_type": "consumerType",
46
+ "is_default": "isDefault",
37
47
  });
38
48
  });
39
49
 
@@ -116,7 +116,6 @@ export * from "./completionevent.js";
116
116
  export * from "./completionfinetunedmodel.js";
117
117
  export * from "./completionresponsestreamchoice.js";
118
118
  export * from "./completionscapability.js";
119
- export * from "./completiontokensdetails.js";
120
119
  export * from "./confusionmatrix.js";
121
120
  export * from "./connectioncredentialsinput.js";
122
121
  export * from "./connectionpreference.js";
@@ -443,7 +442,6 @@ export * from "./messageoutputcontentchunks.js";
443
442
  export * from "./messageoutputentry.js";
444
443
  export * from "./messageoutputevent.js";
445
444
  export * from "./messageresponse.js";
446
- export * from "./messagetokens.js";
447
445
  export * from "./metadatafilter.js";
448
446
  export * from "./metadatafiltergroup.js";
449
447
  export * from "./metricaggregation.js";
@@ -556,7 +554,6 @@ export * from "./prompt.js";
556
554
  export * from "./promptargument.js";
557
555
  export * from "./promptdefinition.js";
558
556
  export * from "./promptscapability.js";
559
- export * from "./prompttokensdetails.js";
560
557
  export * from "./promptvariable.js";
561
558
  export * from "./promptversion.js";
562
559
  export * from "./publicauthenticationmethod.js";
@@ -567,6 +564,17 @@ export * from "./queryworkflowresponse.js";
567
564
  export * from "./range.js";
568
565
  export * from "./rawaudio.js";
569
566
  export * from "./readrequest.js";
567
+ export * from "./realtimespeecherror.js";
568
+ export * from "./realtimespeecherrordetail.js";
569
+ export * from "./realtimespeechinputtextappend.js";
570
+ export * from "./realtimespeechinputtextend.js";
571
+ export * from "./realtimespeechinputtextflush.js";
572
+ export * from "./realtimespeechsession.js";
573
+ export * from "./realtimespeechsessioncreated.js";
574
+ export * from "./realtimespeechsessionupdated.js";
575
+ export * from "./realtimespeechsessionupdatemessage.js";
576
+ export * from "./realtimespeechsessionupdatepayload.js";
577
+ export * from "./realtimespeechstreamingmode.js";
570
578
  export * from "./realtimetranscriptionerror.js";
571
579
  export * from "./realtimetranscriptionerrordetail.js";
572
580
  export * from "./realtimetranscriptioninputaudioappend.js";
@@ -653,7 +661,6 @@ export * from "./responsestextdoneeventlogprob.js";
653
661
  export * from "./responsestextdoneeventlogprobtoplogprob.js";
654
662
  export * from "./responsestoolchoicefunction.js";
655
663
  export * from "./responsestoolfunction.js";
656
- export * from "./roles.js";
657
664
  export * from "./rootscapability.js";
658
665
  export * from "./rrfretriever.js";
659
666
  export * from "./runevaluationsummary.js";
@@ -849,7 +856,6 @@ export * from "./updatesummaryrequestsummary.js";
849
856
  export * from "./updateworkflowresponse.js";
850
857
  export * from "./urlelicitationcapability.js";
851
858
  export * from "./usageinfo.js";
852
- export * from "./usageinfodollardefs.js";
853
859
  export * from "./useridentity.js";
854
860
  export * from "./useridentityapikey.js";
855
861
  export * from "./useridentityorganization.js";
@@ -57,6 +57,8 @@ export const ObservabilityErrorCode = {
57
57
  EvaluationNameAlreadyExists: "EVALUATION_NAME_ALREADY_EXISTS",
58
58
  OptimizationNotFound: "OPTIMIZATION_NOT_FOUND",
59
59
  OptimizationTrialKeyAlreadyExists: "OPTIMIZATION_TRIAL_KEY_ALREADY_EXISTS",
60
+ OptimizationTrialObservationAlreadyExists:
61
+ "OPTIMIZATION_TRIAL_OBSERVATION_ALREADY_EXISTS",
60
62
  TracesFilterQueryParseError: "TRACES_FILTER_QUERY_PARSE_ERROR",
61
63
  TraceNotFound: "TRACE_NOT_FOUND",
62
64
  SpanNotFound: "SPAN_NOT_FOUND",
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
+ import {
10
+ RealtimeSpeechErrorDetail,
11
+ RealtimeSpeechErrorDetail$inboundSchema,
12
+ RealtimeSpeechErrorDetail$Outbound,
13
+ RealtimeSpeechErrorDetail$outboundSchema,
14
+ } from "./realtimespeecherrordetail.js";
15
+
16
+ export type RealtimeSpeechError = {
17
+ type?: "error" | undefined;
18
+ error: RealtimeSpeechErrorDetail;
19
+ };
20
+
21
+ /** @internal */
22
+ export const RealtimeSpeechError$inboundSchema: z.ZodType<
23
+ RealtimeSpeechError,
24
+ unknown
25
+ > = z.object({
26
+ type: z.literal("error").default("error"),
27
+ error: RealtimeSpeechErrorDetail$inboundSchema,
28
+ });
29
+ /** @internal */
30
+ export type RealtimeSpeechError$Outbound = {
31
+ type: "error";
32
+ error: RealtimeSpeechErrorDetail$Outbound;
33
+ };
34
+
35
+ /** @internal */
36
+ export const RealtimeSpeechError$outboundSchema: z.ZodType<
37
+ RealtimeSpeechError$Outbound,
38
+ RealtimeSpeechError
39
+ > = z.object({
40
+ type: z.literal("error").default("error" as const),
41
+ error: RealtimeSpeechErrorDetail$outboundSchema,
42
+ });
43
+
44
+ export function realtimeSpeechErrorToJSON(
45
+ realtimeSpeechError: RealtimeSpeechError,
46
+ ): string {
47
+ return JSON.stringify(
48
+ RealtimeSpeechError$outboundSchema.parse(realtimeSpeechError),
49
+ );
50
+ }
51
+ export function realtimeSpeechErrorFromJSON(
52
+ jsonString: string,
53
+ ): SafeParseResult<RealtimeSpeechError, SDKValidationError> {
54
+ return safeParse(
55
+ jsonString,
56
+ (x) => RealtimeSpeechError$inboundSchema.parse(JSON.parse(x)),
57
+ `Failed to parse 'RealtimeSpeechError' from JSON`,
58
+ );
59
+ }
@@ -0,0 +1,100 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import { smartUnion } from "../../types/smartUnion.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ /**
12
+ * Human-readable error message.
13
+ */
14
+ export type RealtimeSpeechErrorDetailMessage = string | { [k: string]: any };
15
+
16
+ export type RealtimeSpeechErrorDetail = {
17
+ /**
18
+ * Human-readable error message.
19
+ */
20
+ message: string | { [k: string]: any };
21
+ /**
22
+ * Internal error code for debugging.
23
+ */
24
+ code: number;
25
+ };
26
+
27
+ /** @internal */
28
+ export const RealtimeSpeechErrorDetailMessage$inboundSchema: z.ZodType<
29
+ RealtimeSpeechErrorDetailMessage,
30
+ unknown
31
+ > = smartUnion([z.string(), z.record(z.string(), z.any())]);
32
+ /** @internal */
33
+ export type RealtimeSpeechErrorDetailMessage$Outbound = string | {
34
+ [k: string]: any;
35
+ };
36
+
37
+ /** @internal */
38
+ export const RealtimeSpeechErrorDetailMessage$outboundSchema: z.ZodType<
39
+ RealtimeSpeechErrorDetailMessage$Outbound,
40
+ RealtimeSpeechErrorDetailMessage
41
+ > = smartUnion([z.string(), z.record(z.string(), z.any())]);
42
+
43
+ export function realtimeSpeechErrorDetailMessageToJSON(
44
+ realtimeSpeechErrorDetailMessage: RealtimeSpeechErrorDetailMessage,
45
+ ): string {
46
+ return JSON.stringify(
47
+ RealtimeSpeechErrorDetailMessage$outboundSchema.parse(
48
+ realtimeSpeechErrorDetailMessage,
49
+ ),
50
+ );
51
+ }
52
+ export function realtimeSpeechErrorDetailMessageFromJSON(
53
+ jsonString: string,
54
+ ): SafeParseResult<RealtimeSpeechErrorDetailMessage, SDKValidationError> {
55
+ return safeParse(
56
+ jsonString,
57
+ (x) => RealtimeSpeechErrorDetailMessage$inboundSchema.parse(JSON.parse(x)),
58
+ `Failed to parse 'RealtimeSpeechErrorDetailMessage' from JSON`,
59
+ );
60
+ }
61
+
62
+ /** @internal */
63
+ export const RealtimeSpeechErrorDetail$inboundSchema: z.ZodType<
64
+ RealtimeSpeechErrorDetail,
65
+ unknown
66
+ > = z.object({
67
+ message: smartUnion([z.string(), z.record(z.string(), z.any())]),
68
+ code: z.int(),
69
+ });
70
+ /** @internal */
71
+ export type RealtimeSpeechErrorDetail$Outbound = {
72
+ message: string | { [k: string]: any };
73
+ code: number;
74
+ };
75
+
76
+ /** @internal */
77
+ export const RealtimeSpeechErrorDetail$outboundSchema: z.ZodType<
78
+ RealtimeSpeechErrorDetail$Outbound,
79
+ RealtimeSpeechErrorDetail
80
+ > = z.object({
81
+ message: smartUnion([z.string(), z.record(z.string(), z.any())]),
82
+ code: z.int(),
83
+ });
84
+
85
+ export function realtimeSpeechErrorDetailToJSON(
86
+ realtimeSpeechErrorDetail: RealtimeSpeechErrorDetail,
87
+ ): string {
88
+ return JSON.stringify(
89
+ RealtimeSpeechErrorDetail$outboundSchema.parse(realtimeSpeechErrorDetail),
90
+ );
91
+ }
92
+ export function realtimeSpeechErrorDetailFromJSON(
93
+ jsonString: string,
94
+ ): SafeParseResult<RealtimeSpeechErrorDetail, SDKValidationError> {
95
+ return safeParse(
96
+ jsonString,
97
+ (x) => RealtimeSpeechErrorDetail$inboundSchema.parse(JSON.parse(x)),
98
+ `Failed to parse 'RealtimeSpeechErrorDetail' from JSON`,
99
+ );
100
+ }
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
+
10
+ export type RealtimeSpeechInputTextAppend = {
11
+ type?: "input_text.append" | undefined;
12
+ text: string;
13
+ };
14
+
15
+ /** @internal */
16
+ export const RealtimeSpeechInputTextAppend$inboundSchema: z.ZodType<
17
+ RealtimeSpeechInputTextAppend,
18
+ unknown
19
+ > = z.object({
20
+ type: z.literal("input_text.append").default("input_text.append"),
21
+ text: z.string(),
22
+ });
23
+ /** @internal */
24
+ export type RealtimeSpeechInputTextAppend$Outbound = {
25
+ type: "input_text.append";
26
+ text: string;
27
+ };
28
+
29
+ /** @internal */
30
+ export const RealtimeSpeechInputTextAppend$outboundSchema: z.ZodType<
31
+ RealtimeSpeechInputTextAppend$Outbound,
32
+ RealtimeSpeechInputTextAppend
33
+ > = z.object({
34
+ type: z.literal("input_text.append").default("input_text.append" as const),
35
+ text: z.string(),
36
+ });
37
+
38
+ export function realtimeSpeechInputTextAppendToJSON(
39
+ realtimeSpeechInputTextAppend: RealtimeSpeechInputTextAppend,
40
+ ): string {
41
+ return JSON.stringify(
42
+ RealtimeSpeechInputTextAppend$outboundSchema.parse(
43
+ realtimeSpeechInputTextAppend,
44
+ ),
45
+ );
46
+ }
47
+ export function realtimeSpeechInputTextAppendFromJSON(
48
+ jsonString: string,
49
+ ): SafeParseResult<RealtimeSpeechInputTextAppend, SDKValidationError> {
50
+ return safeParse(
51
+ jsonString,
52
+ (x) => RealtimeSpeechInputTextAppend$inboundSchema.parse(JSON.parse(x)),
53
+ `Failed to parse 'RealtimeSpeechInputTextAppend' from JSON`,
54
+ );
55
+ }
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
+
10
+ export type RealtimeSpeechInputTextEnd = {
11
+ type?: "input_text.end" | undefined;
12
+ };
13
+
14
+ /** @internal */
15
+ export const RealtimeSpeechInputTextEnd$inboundSchema: z.ZodType<
16
+ RealtimeSpeechInputTextEnd,
17
+ unknown
18
+ > = z.object({
19
+ type: z.literal("input_text.end").default("input_text.end"),
20
+ });
21
+ /** @internal */
22
+ export type RealtimeSpeechInputTextEnd$Outbound = {
23
+ type: "input_text.end";
24
+ };
25
+
26
+ /** @internal */
27
+ export const RealtimeSpeechInputTextEnd$outboundSchema: z.ZodType<
28
+ RealtimeSpeechInputTextEnd$Outbound,
29
+ RealtimeSpeechInputTextEnd
30
+ > = z.object({
31
+ type: z.literal("input_text.end").default("input_text.end" as const),
32
+ });
33
+
34
+ export function realtimeSpeechInputTextEndToJSON(
35
+ realtimeSpeechInputTextEnd: RealtimeSpeechInputTextEnd,
36
+ ): string {
37
+ return JSON.stringify(
38
+ RealtimeSpeechInputTextEnd$outboundSchema.parse(realtimeSpeechInputTextEnd),
39
+ );
40
+ }
41
+ export function realtimeSpeechInputTextEndFromJSON(
42
+ jsonString: string,
43
+ ): SafeParseResult<RealtimeSpeechInputTextEnd, SDKValidationError> {
44
+ return safeParse(
45
+ jsonString,
46
+ (x) => RealtimeSpeechInputTextEnd$inboundSchema.parse(JSON.parse(x)),
47
+ `Failed to parse 'RealtimeSpeechInputTextEnd' from JSON`,
48
+ );
49
+ }
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
+
10
+ export type RealtimeSpeechInputTextFlush = {
11
+ type?: "input_text.flush" | undefined;
12
+ text?: string | null | undefined;
13
+ };
14
+
15
+ /** @internal */
16
+ export const RealtimeSpeechInputTextFlush$inboundSchema: z.ZodType<
17
+ RealtimeSpeechInputTextFlush,
18
+ unknown
19
+ > = z.object({
20
+ type: z.literal("input_text.flush").default("input_text.flush"),
21
+ text: z.nullable(z.string()).optional(),
22
+ });
23
+ /** @internal */
24
+ export type RealtimeSpeechInputTextFlush$Outbound = {
25
+ type: "input_text.flush";
26
+ text?: string | null | undefined;
27
+ };
28
+
29
+ /** @internal */
30
+ export const RealtimeSpeechInputTextFlush$outboundSchema: z.ZodType<
31
+ RealtimeSpeechInputTextFlush$Outbound,
32
+ RealtimeSpeechInputTextFlush
33
+ > = z.object({
34
+ type: z.literal("input_text.flush").default("input_text.flush" as const),
35
+ text: z.nullable(z.string()).optional(),
36
+ });
37
+
38
+ export function realtimeSpeechInputTextFlushToJSON(
39
+ realtimeSpeechInputTextFlush: RealtimeSpeechInputTextFlush,
40
+ ): string {
41
+ return JSON.stringify(
42
+ RealtimeSpeechInputTextFlush$outboundSchema.parse(
43
+ realtimeSpeechInputTextFlush,
44
+ ),
45
+ );
46
+ }
47
+ export function realtimeSpeechInputTextFlushFromJSON(
48
+ jsonString: string,
49
+ ): SafeParseResult<RealtimeSpeechInputTextFlush, SDKValidationError> {
50
+ return safeParse(
51
+ jsonString,
52
+ (x) => RealtimeSpeechInputTextFlush$inboundSchema.parse(JSON.parse(x)),
53
+ `Failed to parse 'RealtimeSpeechInputTextFlush' from JSON`,
54
+ );
55
+ }
@@ -0,0 +1,98 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ RealtimeSpeechStreamingMode,
12
+ RealtimeSpeechStreamingMode$inboundSchema,
13
+ RealtimeSpeechStreamingMode$outboundSchema,
14
+ } from "./realtimespeechstreamingmode.js";
15
+ import {
16
+ SpeechOutputFormat,
17
+ SpeechOutputFormat$inboundSchema,
18
+ SpeechOutputFormat$outboundSchema,
19
+ } from "./speechoutputformat.js";
20
+
21
+ export type RealtimeSpeechSession = {
22
+ requestId: string;
23
+ model: string;
24
+ voice?: string | null | undefined;
25
+ isRefAudio: boolean;
26
+ streamingMode: RealtimeSpeechStreamingMode;
27
+ responseFormat: SpeechOutputFormat;
28
+ expressiveness: number;
29
+ };
30
+
31
+ /** @internal */
32
+ export const RealtimeSpeechSession$inboundSchema: z.ZodType<
33
+ RealtimeSpeechSession,
34
+ unknown
35
+ > = z.object({
36
+ request_id: z.string(),
37
+ model: z.string(),
38
+ voice: z.nullable(z.string()).optional(),
39
+ is_ref_audio: z.boolean(),
40
+ streaming_mode: RealtimeSpeechStreamingMode$inboundSchema,
41
+ response_format: SpeechOutputFormat$inboundSchema,
42
+ expressiveness: z.number(),
43
+ }).transform((v) => {
44
+ return remap$(v, {
45
+ "request_id": "requestId",
46
+ "is_ref_audio": "isRefAudio",
47
+ "streaming_mode": "streamingMode",
48
+ "response_format": "responseFormat",
49
+ });
50
+ });
51
+ /** @internal */
52
+ export type RealtimeSpeechSession$Outbound = {
53
+ request_id: string;
54
+ model: string;
55
+ voice?: string | null | undefined;
56
+ is_ref_audio: boolean;
57
+ streaming_mode: string;
58
+ response_format: string;
59
+ expressiveness: number;
60
+ };
61
+
62
+ /** @internal */
63
+ export const RealtimeSpeechSession$outboundSchema: z.ZodType<
64
+ RealtimeSpeechSession$Outbound,
65
+ RealtimeSpeechSession
66
+ > = z.object({
67
+ requestId: z.string(),
68
+ model: z.string(),
69
+ voice: z.nullable(z.string()).optional(),
70
+ isRefAudio: z.boolean(),
71
+ streamingMode: RealtimeSpeechStreamingMode$outboundSchema,
72
+ responseFormat: SpeechOutputFormat$outboundSchema,
73
+ expressiveness: z.number(),
74
+ }).transform((v) => {
75
+ return remap$(v, {
76
+ requestId: "request_id",
77
+ isRefAudio: "is_ref_audio",
78
+ streamingMode: "streaming_mode",
79
+ responseFormat: "response_format",
80
+ });
81
+ });
82
+
83
+ export function realtimeSpeechSessionToJSON(
84
+ realtimeSpeechSession: RealtimeSpeechSession,
85
+ ): string {
86
+ return JSON.stringify(
87
+ RealtimeSpeechSession$outboundSchema.parse(realtimeSpeechSession),
88
+ );
89
+ }
90
+ export function realtimeSpeechSessionFromJSON(
91
+ jsonString: string,
92
+ ): SafeParseResult<RealtimeSpeechSession, SDKValidationError> {
93
+ return safeParse(
94
+ jsonString,
95
+ (x) => RealtimeSpeechSession$inboundSchema.parse(JSON.parse(x)),
96
+ `Failed to parse 'RealtimeSpeechSession' from JSON`,
97
+ );
98
+ }
@@ -0,0 +1,61 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
+ import {
10
+ RealtimeSpeechSession,
11
+ RealtimeSpeechSession$inboundSchema,
12
+ RealtimeSpeechSession$Outbound,
13
+ RealtimeSpeechSession$outboundSchema,
14
+ } from "./realtimespeechsession.js";
15
+
16
+ export type RealtimeSpeechSessionCreated = {
17
+ type?: "session.created" | undefined;
18
+ session: RealtimeSpeechSession;
19
+ };
20
+
21
+ /** @internal */
22
+ export const RealtimeSpeechSessionCreated$inboundSchema: z.ZodType<
23
+ RealtimeSpeechSessionCreated,
24
+ unknown
25
+ > = z.object({
26
+ type: z.literal("session.created").default("session.created"),
27
+ session: RealtimeSpeechSession$inboundSchema,
28
+ });
29
+ /** @internal */
30
+ export type RealtimeSpeechSessionCreated$Outbound = {
31
+ type: "session.created";
32
+ session: RealtimeSpeechSession$Outbound;
33
+ };
34
+
35
+ /** @internal */
36
+ export const RealtimeSpeechSessionCreated$outboundSchema: z.ZodType<
37
+ RealtimeSpeechSessionCreated$Outbound,
38
+ RealtimeSpeechSessionCreated
39
+ > = z.object({
40
+ type: z.literal("session.created").default("session.created" as const),
41
+ session: RealtimeSpeechSession$outboundSchema,
42
+ });
43
+
44
+ export function realtimeSpeechSessionCreatedToJSON(
45
+ realtimeSpeechSessionCreated: RealtimeSpeechSessionCreated,
46
+ ): string {
47
+ return JSON.stringify(
48
+ RealtimeSpeechSessionCreated$outboundSchema.parse(
49
+ realtimeSpeechSessionCreated,
50
+ ),
51
+ );
52
+ }
53
+ export function realtimeSpeechSessionCreatedFromJSON(
54
+ jsonString: string,
55
+ ): SafeParseResult<RealtimeSpeechSessionCreated, SDKValidationError> {
56
+ return safeParse(
57
+ jsonString,
58
+ (x) => RealtimeSpeechSessionCreated$inboundSchema.parse(JSON.parse(x)),
59
+ `Failed to parse 'RealtimeSpeechSessionCreated' from JSON`,
60
+ );
61
+ }