@mistralai/mistralai 1.9.18 → 1.9.19
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.
- package/jsr.json +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/config.js +2 -2
- package/models/components/apiendpoint.d.ts +5 -0
- package/models/components/apiendpoint.d.ts.map +1 -1
- package/models/components/apiendpoint.js +5 -0
- package/models/components/apiendpoint.js.map +1 -1
- package/models/components/embeddingrequest.d.ts +3 -0
- package/models/components/embeddingrequest.d.ts.map +1 -1
- package/models/components/embeddingrequest.js +5 -0
- package/models/components/embeddingrequest.js.map +1 -1
- package/models/components/encodingformat.d.ts +28 -0
- package/models/components/encodingformat.d.ts.map +1 -0
- package/models/components/encodingformat.js +50 -0
- package/models/components/encodingformat.js.map +1 -0
- package/models/components/index.d.ts +2 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +2 -0
- package/models/components/index.js.map +1 -1
- package/models/components/systemmessage.d.ts +5 -5
- package/models/components/systemmessage.d.ts.map +1 -1
- package/models/components/systemmessage.js +11 -5
- package/models/components/systemmessage.js.map +1 -1
- package/models/components/systemmessagecontentchunks.d.ts +35 -0
- package/models/components/systemmessagecontentchunks.d.ts.map +1 -0
- package/models/components/systemmessagecontentchunks.js +67 -0
- package/models/components/systemmessagecontentchunks.js.map +1 -0
- package/package.json +1 -1
- package/packages/mistralai-azure/jsr.json +1 -1
- package/packages/mistralai-azure/package-lock.json +2 -2
- package/packages/mistralai-azure/package.json +1 -1
- package/packages/mistralai-azure/src/funcs/ocrProcess.ts +160 -0
- package/packages/mistralai-azure/src/lib/config.ts +3 -3
- package/packages/mistralai-azure/src/models/components/chatcompletionrequest.ts +14 -0
- package/packages/mistralai-azure/src/models/components/chatcompletionresponse.ts +8 -8
- package/packages/mistralai-azure/src/models/components/chatcompletionstreamrequest.ts +14 -0
- package/packages/mistralai-azure/src/models/components/documenturlchunk.ts +115 -0
- package/packages/mistralai-azure/src/models/components/filechunk.ts +75 -0
- package/packages/mistralai-azure/src/models/components/index.ts +9 -0
- package/packages/mistralai-azure/src/models/components/mistralpromptmode.ts +47 -0
- package/packages/mistralai-azure/src/models/components/ocrimageobject.ts +126 -0
- package/packages/mistralai-azure/src/models/components/ocrpagedimensions.ts +83 -0
- package/packages/mistralai-azure/src/models/components/ocrpageobject.ts +98 -0
- package/packages/mistralai-azure/src/models/components/ocrrequest.ts +229 -0
- package/packages/mistralai-azure/src/models/components/ocrresponse.ts +106 -0
- package/packages/mistralai-azure/src/models/components/ocrusageinfo.ts +83 -0
- package/packages/mistralai-azure/src/models/components/usageinfo.ts +37 -17
- package/packages/mistralai-azure/src/sdk/ocr.ts +24 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/apiendpoint.ts +5 -0
- package/src/models/components/embeddingrequest.ts +11 -0
- package/src/models/components/encodingformat.ts +33 -0
- package/src/models/components/index.ts +2 -0
- package/src/models/components/systemmessage.ts +21 -13
- package/src/models/components/systemmessagecontentchunks.ts +92 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { MistralAzureCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as components from "../models/components/index.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../models/errors/httpclienterrors.js";
|
|
21
|
+
import * as errors from "../models/errors/index.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 { Result } from "../types/fp.js";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* OCR
|
|
29
|
+
*/
|
|
30
|
+
export function ocrProcess(
|
|
31
|
+
client: MistralAzureCore,
|
|
32
|
+
request: components.OCRRequest,
|
|
33
|
+
options?: RequestOptions,
|
|
34
|
+
): APIPromise<
|
|
35
|
+
Result<
|
|
36
|
+
components.OCRResponse,
|
|
37
|
+
| errors.HTTPValidationError
|
|
38
|
+
| SDKError
|
|
39
|
+
| SDKValidationError
|
|
40
|
+
| UnexpectedClientError
|
|
41
|
+
| InvalidRequestError
|
|
42
|
+
| RequestAbortedError
|
|
43
|
+
| RequestTimeoutError
|
|
44
|
+
| ConnectionError
|
|
45
|
+
>
|
|
46
|
+
> {
|
|
47
|
+
return new APIPromise($do(
|
|
48
|
+
client,
|
|
49
|
+
request,
|
|
50
|
+
options,
|
|
51
|
+
));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function $do(
|
|
55
|
+
client: MistralAzureCore,
|
|
56
|
+
request: components.OCRRequest,
|
|
57
|
+
options?: RequestOptions,
|
|
58
|
+
): Promise<
|
|
59
|
+
[
|
|
60
|
+
Result<
|
|
61
|
+
components.OCRResponse,
|
|
62
|
+
| errors.HTTPValidationError
|
|
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.OCRRequest$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 = encodeJSON("body", payload, { explode: true });
|
|
84
|
+
|
|
85
|
+
const path = pathToFunc("/ocr")();
|
|
86
|
+
|
|
87
|
+
const headers = new Headers(compactMap({
|
|
88
|
+
"Content-Type": "application/json",
|
|
89
|
+
Accept: "application/json",
|
|
90
|
+
}));
|
|
91
|
+
|
|
92
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
93
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
94
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
95
|
+
|
|
96
|
+
const context = {
|
|
97
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
98
|
+
operationID: "ocr_v1_ocr_post",
|
|
99
|
+
oAuth2Scopes: [],
|
|
100
|
+
|
|
101
|
+
resolvedSecurity: requestSecurity,
|
|
102
|
+
|
|
103
|
+
securitySource: client._options.apiKey,
|
|
104
|
+
retryConfig: options?.retries
|
|
105
|
+
|| client._options.retryConfig
|
|
106
|
+
|| { strategy: "none" },
|
|
107
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const requestRes = client._createRequest(context, {
|
|
111
|
+
security: requestSecurity,
|
|
112
|
+
method: "POST",
|
|
113
|
+
baseURL: options?.serverURL,
|
|
114
|
+
path: path,
|
|
115
|
+
headers: headers,
|
|
116
|
+
body: body,
|
|
117
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
118
|
+
}, options);
|
|
119
|
+
if (!requestRes.ok) {
|
|
120
|
+
return [requestRes, { status: "invalid" }];
|
|
121
|
+
}
|
|
122
|
+
const req = requestRes.value;
|
|
123
|
+
|
|
124
|
+
const doResult = await client._do(req, {
|
|
125
|
+
context,
|
|
126
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
127
|
+
retryConfig: context.retryConfig,
|
|
128
|
+
retryCodes: context.retryCodes,
|
|
129
|
+
});
|
|
130
|
+
if (!doResult.ok) {
|
|
131
|
+
return [doResult, { status: "request-error", request: req }];
|
|
132
|
+
}
|
|
133
|
+
const response = doResult.value;
|
|
134
|
+
|
|
135
|
+
const responseFields = {
|
|
136
|
+
HttpMeta: { Response: response, Request: req },
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const [result] = await M.match<
|
|
140
|
+
components.OCRResponse,
|
|
141
|
+
| errors.HTTPValidationError
|
|
142
|
+
| SDKError
|
|
143
|
+
| SDKValidationError
|
|
144
|
+
| UnexpectedClientError
|
|
145
|
+
| InvalidRequestError
|
|
146
|
+
| RequestAbortedError
|
|
147
|
+
| RequestTimeoutError
|
|
148
|
+
| ConnectionError
|
|
149
|
+
>(
|
|
150
|
+
M.json(200, components.OCRResponse$inboundSchema),
|
|
151
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
152
|
+
M.fail("4XX"),
|
|
153
|
+
M.fail("5XX"),
|
|
154
|
+
)(response, { extraFields: responseFields });
|
|
155
|
+
if (!result.ok) {
|
|
156
|
+
return [result, { status: "complete", request: req, response }];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return [result, { status: "complete", request: req, response }];
|
|
160
|
+
}
|
|
@@ -54,9 +54,9 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
54
54
|
|
|
55
55
|
export const SDK_METADATA = {
|
|
56
56
|
language: "typescript",
|
|
57
|
-
openapiDocVersion: "0.0
|
|
58
|
-
sdkVersion: "1.
|
|
57
|
+
openapiDocVersion: "1.0.0",
|
|
58
|
+
sdkVersion: "1.6.0",
|
|
59
59
|
genVersion: "2.548.6",
|
|
60
60
|
userAgent:
|
|
61
|
-
"speakeasy-sdk/typescript 1.
|
|
61
|
+
"speakeasy-sdk/typescript 1.6.0 2.548.6 1.0.0 @mistralai/mistralai-azure",
|
|
62
62
|
} as const;
|
|
@@ -13,6 +13,11 @@ import {
|
|
|
13
13
|
AssistantMessage$Outbound,
|
|
14
14
|
AssistantMessage$outboundSchema,
|
|
15
15
|
} from "./assistantmessage.js";
|
|
16
|
+
import {
|
|
17
|
+
MistralPromptMode,
|
|
18
|
+
MistralPromptMode$inboundSchema,
|
|
19
|
+
MistralPromptMode$outboundSchema,
|
|
20
|
+
} from "./mistralpromptmode.js";
|
|
16
21
|
import {
|
|
17
22
|
Prediction,
|
|
18
23
|
Prediction$inboundSchema,
|
|
@@ -129,6 +134,10 @@ export type ChatCompletionRequest = {
|
|
|
129
134
|
n?: number | null | undefined;
|
|
130
135
|
prediction?: Prediction | undefined;
|
|
131
136
|
parallelToolCalls?: boolean | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
139
|
+
*/
|
|
140
|
+
promptMode?: MistralPromptMode | null | undefined;
|
|
132
141
|
/**
|
|
133
142
|
* Whether to inject a safety prompt before all conversations.
|
|
134
143
|
*/
|
|
@@ -369,6 +378,7 @@ export const ChatCompletionRequest$inboundSchema: z.ZodType<
|
|
|
369
378
|
n: z.nullable(z.number().int()).optional(),
|
|
370
379
|
prediction: Prediction$inboundSchema.optional(),
|
|
371
380
|
parallel_tool_calls: z.boolean().optional(),
|
|
381
|
+
prompt_mode: z.nullable(MistralPromptMode$inboundSchema).optional(),
|
|
372
382
|
safe_prompt: z.boolean().optional(),
|
|
373
383
|
}).transform((v) => {
|
|
374
384
|
return remap$(v, {
|
|
@@ -380,6 +390,7 @@ export const ChatCompletionRequest$inboundSchema: z.ZodType<
|
|
|
380
390
|
"presence_penalty": "presencePenalty",
|
|
381
391
|
"frequency_penalty": "frequencyPenalty",
|
|
382
392
|
"parallel_tool_calls": "parallelToolCalls",
|
|
393
|
+
"prompt_mode": "promptMode",
|
|
383
394
|
"safe_prompt": "safePrompt",
|
|
384
395
|
});
|
|
385
396
|
});
|
|
@@ -407,6 +418,7 @@ export type ChatCompletionRequest$Outbound = {
|
|
|
407
418
|
n?: number | null | undefined;
|
|
408
419
|
prediction?: Prediction$Outbound | undefined;
|
|
409
420
|
parallel_tool_calls?: boolean | undefined;
|
|
421
|
+
prompt_mode?: string | null | undefined;
|
|
410
422
|
safe_prompt?: boolean | undefined;
|
|
411
423
|
};
|
|
412
424
|
|
|
@@ -458,6 +470,7 @@ export const ChatCompletionRequest$outboundSchema: z.ZodType<
|
|
|
458
470
|
n: z.nullable(z.number().int()).optional(),
|
|
459
471
|
prediction: Prediction$outboundSchema.optional(),
|
|
460
472
|
parallelToolCalls: z.boolean().optional(),
|
|
473
|
+
promptMode: z.nullable(MistralPromptMode$outboundSchema).optional(),
|
|
461
474
|
safePrompt: z.boolean().optional(),
|
|
462
475
|
}).transform((v) => {
|
|
463
476
|
return remap$(v, {
|
|
@@ -469,6 +482,7 @@ export const ChatCompletionRequest$outboundSchema: z.ZodType<
|
|
|
469
482
|
presencePenalty: "presence_penalty",
|
|
470
483
|
frequencyPenalty: "frequency_penalty",
|
|
471
484
|
parallelToolCalls: "parallel_tool_calls",
|
|
485
|
+
promptMode: "prompt_mode",
|
|
472
486
|
safePrompt: "safe_prompt",
|
|
473
487
|
});
|
|
474
488
|
});
|
|
@@ -24,8 +24,8 @@ export type ChatCompletionResponse = {
|
|
|
24
24
|
object: string;
|
|
25
25
|
model: string;
|
|
26
26
|
usage: UsageInfo;
|
|
27
|
-
created
|
|
28
|
-
choices
|
|
27
|
+
created: number;
|
|
28
|
+
choices: Array<ChatCompletionChoice>;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
/** @internal */
|
|
@@ -38,8 +38,8 @@ export const ChatCompletionResponse$inboundSchema: z.ZodType<
|
|
|
38
38
|
object: z.string(),
|
|
39
39
|
model: z.string(),
|
|
40
40
|
usage: UsageInfo$inboundSchema,
|
|
41
|
-
created: z.number().int()
|
|
42
|
-
choices: z.array(ChatCompletionChoice$inboundSchema)
|
|
41
|
+
created: z.number().int(),
|
|
42
|
+
choices: z.array(ChatCompletionChoice$inboundSchema),
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
/** @internal */
|
|
@@ -48,8 +48,8 @@ export type ChatCompletionResponse$Outbound = {
|
|
|
48
48
|
object: string;
|
|
49
49
|
model: string;
|
|
50
50
|
usage: UsageInfo$Outbound;
|
|
51
|
-
created
|
|
52
|
-
choices
|
|
51
|
+
created: number;
|
|
52
|
+
choices: Array<ChatCompletionChoice$Outbound>;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
/** @internal */
|
|
@@ -62,8 +62,8 @@ export const ChatCompletionResponse$outboundSchema: z.ZodType<
|
|
|
62
62
|
object: z.string(),
|
|
63
63
|
model: z.string(),
|
|
64
64
|
usage: UsageInfo$outboundSchema,
|
|
65
|
-
created: z.number().int()
|
|
66
|
-
choices: z.array(ChatCompletionChoice$outboundSchema)
|
|
65
|
+
created: z.number().int(),
|
|
66
|
+
choices: z.array(ChatCompletionChoice$outboundSchema),
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
/**
|
|
@@ -13,6 +13,11 @@ import {
|
|
|
13
13
|
AssistantMessage$Outbound,
|
|
14
14
|
AssistantMessage$outboundSchema,
|
|
15
15
|
} from "./assistantmessage.js";
|
|
16
|
+
import {
|
|
17
|
+
MistralPromptMode,
|
|
18
|
+
MistralPromptMode$inboundSchema,
|
|
19
|
+
MistralPromptMode$outboundSchema,
|
|
20
|
+
} from "./mistralpromptmode.js";
|
|
16
21
|
import {
|
|
17
22
|
Prediction,
|
|
18
23
|
Prediction$inboundSchema,
|
|
@@ -126,6 +131,10 @@ export type ChatCompletionStreamRequest = {
|
|
|
126
131
|
n?: number | null | undefined;
|
|
127
132
|
prediction?: Prediction | undefined;
|
|
128
133
|
parallelToolCalls?: boolean | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
136
|
+
*/
|
|
137
|
+
promptMode?: MistralPromptMode | null | undefined;
|
|
129
138
|
/**
|
|
130
139
|
* Whether to inject a safety prompt before all conversations.
|
|
131
140
|
*/
|
|
@@ -353,6 +362,7 @@ export const ChatCompletionStreamRequest$inboundSchema: z.ZodType<
|
|
|
353
362
|
n: z.nullable(z.number().int()).optional(),
|
|
354
363
|
prediction: Prediction$inboundSchema.optional(),
|
|
355
364
|
parallel_tool_calls: z.boolean().optional(),
|
|
365
|
+
prompt_mode: z.nullable(MistralPromptMode$inboundSchema).optional(),
|
|
356
366
|
safe_prompt: z.boolean().optional(),
|
|
357
367
|
}).transform((v) => {
|
|
358
368
|
return remap$(v, {
|
|
@@ -364,6 +374,7 @@ export const ChatCompletionStreamRequest$inboundSchema: z.ZodType<
|
|
|
364
374
|
"presence_penalty": "presencePenalty",
|
|
365
375
|
"frequency_penalty": "frequencyPenalty",
|
|
366
376
|
"parallel_tool_calls": "parallelToolCalls",
|
|
377
|
+
"prompt_mode": "promptMode",
|
|
367
378
|
"safe_prompt": "safePrompt",
|
|
368
379
|
});
|
|
369
380
|
});
|
|
@@ -391,6 +402,7 @@ export type ChatCompletionStreamRequest$Outbound = {
|
|
|
391
402
|
n?: number | null | undefined;
|
|
392
403
|
prediction?: Prediction$Outbound | undefined;
|
|
393
404
|
parallel_tool_calls?: boolean | undefined;
|
|
405
|
+
prompt_mode?: string | null | undefined;
|
|
394
406
|
safe_prompt?: boolean | undefined;
|
|
395
407
|
};
|
|
396
408
|
|
|
@@ -442,6 +454,7 @@ export const ChatCompletionStreamRequest$outboundSchema: z.ZodType<
|
|
|
442
454
|
n: z.nullable(z.number().int()).optional(),
|
|
443
455
|
prediction: Prediction$outboundSchema.optional(),
|
|
444
456
|
parallelToolCalls: z.boolean().optional(),
|
|
457
|
+
promptMode: z.nullable(MistralPromptMode$outboundSchema).optional(),
|
|
445
458
|
safePrompt: z.boolean().optional(),
|
|
446
459
|
}).transform((v) => {
|
|
447
460
|
return remap$(v, {
|
|
@@ -453,6 +466,7 @@ export const ChatCompletionStreamRequest$outboundSchema: z.ZodType<
|
|
|
453
466
|
presencePenalty: "presence_penalty",
|
|
454
467
|
frequencyPenalty: "frequency_penalty",
|
|
455
468
|
parallelToolCalls: "parallel_tool_calls",
|
|
469
|
+
promptMode: "prompt_mode",
|
|
456
470
|
safePrompt: "safe_prompt",
|
|
457
471
|
});
|
|
458
472
|
});
|
|
@@ -0,0 +1,115 @@
|
|
|
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 DocumentURLChunkType = {
|
|
13
|
+
DocumentUrl: "document_url",
|
|
14
|
+
} as const;
|
|
15
|
+
export type DocumentURLChunkType = ClosedEnum<typeof DocumentURLChunkType>;
|
|
16
|
+
|
|
17
|
+
export type DocumentURLChunk = {
|
|
18
|
+
documentUrl: string;
|
|
19
|
+
/**
|
|
20
|
+
* The filename of the document
|
|
21
|
+
*/
|
|
22
|
+
documentName?: string | null | undefined;
|
|
23
|
+
type?: DocumentURLChunkType | undefined;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** @internal */
|
|
27
|
+
export const DocumentURLChunkType$inboundSchema: z.ZodNativeEnum<
|
|
28
|
+
typeof DocumentURLChunkType
|
|
29
|
+
> = z.nativeEnum(DocumentURLChunkType);
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const DocumentURLChunkType$outboundSchema: z.ZodNativeEnum<
|
|
33
|
+
typeof DocumentURLChunkType
|
|
34
|
+
> = DocumentURLChunkType$inboundSchema;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
39
|
+
*/
|
|
40
|
+
export namespace DocumentURLChunkType$ {
|
|
41
|
+
/** @deprecated use `DocumentURLChunkType$inboundSchema` instead. */
|
|
42
|
+
export const inboundSchema = DocumentURLChunkType$inboundSchema;
|
|
43
|
+
/** @deprecated use `DocumentURLChunkType$outboundSchema` instead. */
|
|
44
|
+
export const outboundSchema = DocumentURLChunkType$outboundSchema;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** @internal */
|
|
48
|
+
export const DocumentURLChunk$inboundSchema: z.ZodType<
|
|
49
|
+
DocumentURLChunk,
|
|
50
|
+
z.ZodTypeDef,
|
|
51
|
+
unknown
|
|
52
|
+
> = z.object({
|
|
53
|
+
document_url: z.string(),
|
|
54
|
+
document_name: z.nullable(z.string()).optional(),
|
|
55
|
+
type: DocumentURLChunkType$inboundSchema.default("document_url"),
|
|
56
|
+
}).transform((v) => {
|
|
57
|
+
return remap$(v, {
|
|
58
|
+
"document_url": "documentUrl",
|
|
59
|
+
"document_name": "documentName",
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
/** @internal */
|
|
64
|
+
export type DocumentURLChunk$Outbound = {
|
|
65
|
+
document_url: string;
|
|
66
|
+
document_name?: string | null | undefined;
|
|
67
|
+
type: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/** @internal */
|
|
71
|
+
export const DocumentURLChunk$outboundSchema: z.ZodType<
|
|
72
|
+
DocumentURLChunk$Outbound,
|
|
73
|
+
z.ZodTypeDef,
|
|
74
|
+
DocumentURLChunk
|
|
75
|
+
> = z.object({
|
|
76
|
+
documentUrl: z.string(),
|
|
77
|
+
documentName: z.nullable(z.string()).optional(),
|
|
78
|
+
type: DocumentURLChunkType$outboundSchema.default("document_url"),
|
|
79
|
+
}).transform((v) => {
|
|
80
|
+
return remap$(v, {
|
|
81
|
+
documentUrl: "document_url",
|
|
82
|
+
documentName: "document_name",
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @internal
|
|
88
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
89
|
+
*/
|
|
90
|
+
export namespace DocumentURLChunk$ {
|
|
91
|
+
/** @deprecated use `DocumentURLChunk$inboundSchema` instead. */
|
|
92
|
+
export const inboundSchema = DocumentURLChunk$inboundSchema;
|
|
93
|
+
/** @deprecated use `DocumentURLChunk$outboundSchema` instead. */
|
|
94
|
+
export const outboundSchema = DocumentURLChunk$outboundSchema;
|
|
95
|
+
/** @deprecated use `DocumentURLChunk$Outbound` instead. */
|
|
96
|
+
export type Outbound = DocumentURLChunk$Outbound;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function documentURLChunkToJSON(
|
|
100
|
+
documentURLChunk: DocumentURLChunk,
|
|
101
|
+
): string {
|
|
102
|
+
return JSON.stringify(
|
|
103
|
+
DocumentURLChunk$outboundSchema.parse(documentURLChunk),
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function documentURLChunkFromJSON(
|
|
108
|
+
jsonString: string,
|
|
109
|
+
): SafeParseResult<DocumentURLChunk, SDKValidationError> {
|
|
110
|
+
return safeParse(
|
|
111
|
+
jsonString,
|
|
112
|
+
(x) => DocumentURLChunk$inboundSchema.parse(JSON.parse(x)),
|
|
113
|
+
`Failed to parse 'DocumentURLChunk' from JSON`,
|
|
114
|
+
);
|
|
115
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
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 { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type FileChunk = {
|
|
12
|
+
type?: "file" | undefined;
|
|
13
|
+
fileId: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const FileChunk$inboundSchema: z.ZodType<
|
|
18
|
+
FileChunk,
|
|
19
|
+
z.ZodTypeDef,
|
|
20
|
+
unknown
|
|
21
|
+
> = z.object({
|
|
22
|
+
type: z.literal("file").default("file"),
|
|
23
|
+
file_id: z.string(),
|
|
24
|
+
}).transform((v) => {
|
|
25
|
+
return remap$(v, {
|
|
26
|
+
"file_id": "fileId",
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export type FileChunk$Outbound = {
|
|
32
|
+
type: "file";
|
|
33
|
+
file_id: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const FileChunk$outboundSchema: z.ZodType<
|
|
38
|
+
FileChunk$Outbound,
|
|
39
|
+
z.ZodTypeDef,
|
|
40
|
+
FileChunk
|
|
41
|
+
> = z.object({
|
|
42
|
+
type: z.literal("file").default("file" as const),
|
|
43
|
+
fileId: z.string(),
|
|
44
|
+
}).transform((v) => {
|
|
45
|
+
return remap$(v, {
|
|
46
|
+
fileId: "file_id",
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
53
|
+
*/
|
|
54
|
+
export namespace FileChunk$ {
|
|
55
|
+
/** @deprecated use `FileChunk$inboundSchema` instead. */
|
|
56
|
+
export const inboundSchema = FileChunk$inboundSchema;
|
|
57
|
+
/** @deprecated use `FileChunk$outboundSchema` instead. */
|
|
58
|
+
export const outboundSchema = FileChunk$outboundSchema;
|
|
59
|
+
/** @deprecated use `FileChunk$Outbound` instead. */
|
|
60
|
+
export type Outbound = FileChunk$Outbound;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function fileChunkToJSON(fileChunk: FileChunk): string {
|
|
64
|
+
return JSON.stringify(FileChunk$outboundSchema.parse(fileChunk));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function fileChunkFromJSON(
|
|
68
|
+
jsonString: string,
|
|
69
|
+
): SafeParseResult<FileChunk, SDKValidationError> {
|
|
70
|
+
return safeParse(
|
|
71
|
+
jsonString,
|
|
72
|
+
(x) => FileChunk$inboundSchema.parse(JSON.parse(x)),
|
|
73
|
+
`Failed to parse 'FileChunk' from JSON`,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -12,12 +12,21 @@ export * from "./completionevent.js";
|
|
|
12
12
|
export * from "./completionresponsestreamchoice.js";
|
|
13
13
|
export * from "./contentchunk.js";
|
|
14
14
|
export * from "./deltamessage.js";
|
|
15
|
+
export * from "./documenturlchunk.js";
|
|
16
|
+
export * from "./filechunk.js";
|
|
15
17
|
export * from "./function.js";
|
|
16
18
|
export * from "./functioncall.js";
|
|
17
19
|
export * from "./functionname.js";
|
|
18
20
|
export * from "./imageurl.js";
|
|
19
21
|
export * from "./imageurlchunk.js";
|
|
20
22
|
export * from "./jsonschema.js";
|
|
23
|
+
export * from "./mistralpromptmode.js";
|
|
24
|
+
export * from "./ocrimageobject.js";
|
|
25
|
+
export * from "./ocrpagedimensions.js";
|
|
26
|
+
export * from "./ocrpageobject.js";
|
|
27
|
+
export * from "./ocrrequest.js";
|
|
28
|
+
export * from "./ocrresponse.js";
|
|
29
|
+
export * from "./ocrusageinfo.js";
|
|
21
30
|
export * from "./prediction.js";
|
|
22
31
|
export * from "./referencechunk.js";
|
|
23
32
|
export * from "./responseformat.js";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import {
|
|
7
|
+
catchUnrecognizedEnum,
|
|
8
|
+
OpenEnum,
|
|
9
|
+
Unrecognized,
|
|
10
|
+
} from "../../types/enums.js";
|
|
11
|
+
|
|
12
|
+
export const MistralPromptMode = {
|
|
13
|
+
Reasoning: "reasoning",
|
|
14
|
+
} as const;
|
|
15
|
+
export type MistralPromptMode = OpenEnum<typeof MistralPromptMode>;
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const MistralPromptMode$inboundSchema: z.ZodType<
|
|
19
|
+
MistralPromptMode,
|
|
20
|
+
z.ZodTypeDef,
|
|
21
|
+
unknown
|
|
22
|
+
> = z
|
|
23
|
+
.union([
|
|
24
|
+
z.nativeEnum(MistralPromptMode),
|
|
25
|
+
z.string().transform(catchUnrecognizedEnum),
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const MistralPromptMode$outboundSchema: z.ZodType<
|
|
30
|
+
MistralPromptMode,
|
|
31
|
+
z.ZodTypeDef,
|
|
32
|
+
MistralPromptMode
|
|
33
|
+
> = z.union([
|
|
34
|
+
z.nativeEnum(MistralPromptMode),
|
|
35
|
+
z.string().and(z.custom<Unrecognized<string>>()),
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
41
|
+
*/
|
|
42
|
+
export namespace MistralPromptMode$ {
|
|
43
|
+
/** @deprecated use `MistralPromptMode$inboundSchema` instead. */
|
|
44
|
+
export const inboundSchema = MistralPromptMode$inboundSchema;
|
|
45
|
+
/** @deprecated use `MistralPromptMode$outboundSchema` instead. */
|
|
46
|
+
export const outboundSchema = MistralPromptMode$outboundSchema;
|
|
47
|
+
}
|