@mistralai/mistralai 1.9.17 → 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/messageinputcontentchunks.d.ts +3 -2
- package/models/components/messageinputcontentchunks.d.ts.map +1 -1
- package/models/components/messageinputcontentchunks.js +3 -0
- package/models/components/messageinputcontentchunks.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/messageinputcontentchunks.ts +10 -0
- package/src/models/components/systemmessage.ts +21 -13
- package/src/models/components/systemmessagecontentchunks.ts +92 -0
|
@@ -0,0 +1,83 @@
|
|
|
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 OCRUsageInfo = {
|
|
12
|
+
/**
|
|
13
|
+
* Number of pages processed
|
|
14
|
+
*/
|
|
15
|
+
pagesProcessed: number;
|
|
16
|
+
/**
|
|
17
|
+
* Document size in bytes
|
|
18
|
+
*/
|
|
19
|
+
docSizeBytes?: number | null | undefined;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** @internal */
|
|
23
|
+
export const OCRUsageInfo$inboundSchema: z.ZodType<
|
|
24
|
+
OCRUsageInfo,
|
|
25
|
+
z.ZodTypeDef,
|
|
26
|
+
unknown
|
|
27
|
+
> = z.object({
|
|
28
|
+
pages_processed: z.number().int(),
|
|
29
|
+
doc_size_bytes: z.nullable(z.number().int()).optional(),
|
|
30
|
+
}).transform((v) => {
|
|
31
|
+
return remap$(v, {
|
|
32
|
+
"pages_processed": "pagesProcessed",
|
|
33
|
+
"doc_size_bytes": "docSizeBytes",
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/** @internal */
|
|
38
|
+
export type OCRUsageInfo$Outbound = {
|
|
39
|
+
pages_processed: number;
|
|
40
|
+
doc_size_bytes?: number | null | undefined;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** @internal */
|
|
44
|
+
export const OCRUsageInfo$outboundSchema: z.ZodType<
|
|
45
|
+
OCRUsageInfo$Outbound,
|
|
46
|
+
z.ZodTypeDef,
|
|
47
|
+
OCRUsageInfo
|
|
48
|
+
> = z.object({
|
|
49
|
+
pagesProcessed: z.number().int(),
|
|
50
|
+
docSizeBytes: z.nullable(z.number().int()).optional(),
|
|
51
|
+
}).transform((v) => {
|
|
52
|
+
return remap$(v, {
|
|
53
|
+
pagesProcessed: "pages_processed",
|
|
54
|
+
docSizeBytes: "doc_size_bytes",
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @internal
|
|
60
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
61
|
+
*/
|
|
62
|
+
export namespace OCRUsageInfo$ {
|
|
63
|
+
/** @deprecated use `OCRUsageInfo$inboundSchema` instead. */
|
|
64
|
+
export const inboundSchema = OCRUsageInfo$inboundSchema;
|
|
65
|
+
/** @deprecated use `OCRUsageInfo$outboundSchema` instead. */
|
|
66
|
+
export const outboundSchema = OCRUsageInfo$outboundSchema;
|
|
67
|
+
/** @deprecated use `OCRUsageInfo$Outbound` instead. */
|
|
68
|
+
export type Outbound = OCRUsageInfo$Outbound;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function ocrUsageInfoToJSON(ocrUsageInfo: OCRUsageInfo): string {
|
|
72
|
+
return JSON.stringify(OCRUsageInfo$outboundSchema.parse(ocrUsageInfo));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function ocrUsageInfoFromJSON(
|
|
76
|
+
jsonString: string,
|
|
77
|
+
): SafeParseResult<OCRUsageInfo, SDKValidationError> {
|
|
78
|
+
return safeParse(
|
|
79
|
+
jsonString,
|
|
80
|
+
(x) => OCRUsageInfo$inboundSchema.parse(JSON.parse(x)),
|
|
81
|
+
`Failed to parse 'OCRUsageInfo' from JSON`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -4,14 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
collectExtraKeys as collectExtraKeys$,
|
|
9
|
+
safeParse,
|
|
10
|
+
} from "../../lib/schemas.js";
|
|
8
11
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
12
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
13
|
|
|
11
14
|
export type UsageInfo = {
|
|
12
|
-
promptTokens
|
|
13
|
-
completionTokens
|
|
14
|
-
totalTokens
|
|
15
|
+
promptTokens?: number | undefined;
|
|
16
|
+
completionTokens?: number | undefined;
|
|
17
|
+
totalTokens?: number | undefined;
|
|
18
|
+
promptAudioSeconds?: number | null | undefined;
|
|
19
|
+
additionalProperties?: { [k: string]: any };
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
/** @internal */
|
|
@@ -19,15 +24,21 @@ export const UsageInfo$inboundSchema: z.ZodType<
|
|
|
19
24
|
UsageInfo,
|
|
20
25
|
z.ZodTypeDef,
|
|
21
26
|
unknown
|
|
22
|
-
> =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
> = collectExtraKeys$(
|
|
28
|
+
z.object({
|
|
29
|
+
prompt_tokens: z.number().int().default(0),
|
|
30
|
+
completion_tokens: z.number().int().default(0),
|
|
31
|
+
total_tokens: z.number().int().default(0),
|
|
32
|
+
prompt_audio_seconds: z.nullable(z.number().int()).optional(),
|
|
33
|
+
}).catchall(z.any()),
|
|
34
|
+
"additionalProperties",
|
|
35
|
+
true,
|
|
36
|
+
).transform((v) => {
|
|
27
37
|
return remap$(v, {
|
|
28
38
|
"prompt_tokens": "promptTokens",
|
|
29
39
|
"completion_tokens": "completionTokens",
|
|
30
40
|
"total_tokens": "totalTokens",
|
|
41
|
+
"prompt_audio_seconds": "promptAudioSeconds",
|
|
31
42
|
});
|
|
32
43
|
});
|
|
33
44
|
|
|
@@ -36,6 +47,8 @@ export type UsageInfo$Outbound = {
|
|
|
36
47
|
prompt_tokens: number;
|
|
37
48
|
completion_tokens: number;
|
|
38
49
|
total_tokens: number;
|
|
50
|
+
prompt_audio_seconds?: number | null | undefined;
|
|
51
|
+
[additionalProperties: string]: unknown;
|
|
39
52
|
};
|
|
40
53
|
|
|
41
54
|
/** @internal */
|
|
@@ -44,15 +57,22 @@ export const UsageInfo$outboundSchema: z.ZodType<
|
|
|
44
57
|
z.ZodTypeDef,
|
|
45
58
|
UsageInfo
|
|
46
59
|
> = z.object({
|
|
47
|
-
promptTokens: z.number().int(),
|
|
48
|
-
completionTokens: z.number().int(),
|
|
49
|
-
totalTokens: z.number().int(),
|
|
60
|
+
promptTokens: z.number().int().default(0),
|
|
61
|
+
completionTokens: z.number().int().default(0),
|
|
62
|
+
totalTokens: z.number().int().default(0),
|
|
63
|
+
promptAudioSeconds: z.nullable(z.number().int()).optional(),
|
|
64
|
+
additionalProperties: z.record(z.any()),
|
|
50
65
|
}).transform((v) => {
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
return {
|
|
67
|
+
...v.additionalProperties,
|
|
68
|
+
...remap$(v, {
|
|
69
|
+
promptTokens: "prompt_tokens",
|
|
70
|
+
completionTokens: "completion_tokens",
|
|
71
|
+
totalTokens: "total_tokens",
|
|
72
|
+
promptAudioSeconds: "prompt_audio_seconds",
|
|
73
|
+
additionalProperties: null,
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
56
76
|
});
|
|
57
77
|
|
|
58
78
|
/**
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { ocrProcess } from "../funcs/ocrProcess.js";
|
|
6
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
7
|
+
import * as components from "../models/components/index.js";
|
|
8
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
9
|
+
|
|
10
|
+
export class Ocr extends ClientSDK {
|
|
11
|
+
/**
|
|
12
|
+
* OCR
|
|
13
|
+
*/
|
|
14
|
+
async process(
|
|
15
|
+
request: components.OCRRequest,
|
|
16
|
+
options?: RequestOptions,
|
|
17
|
+
): Promise<components.OCRResponse> {
|
|
18
|
+
return unwrapAsync(ocrProcess(
|
|
19
|
+
this,
|
|
20
|
+
request,
|
|
21
|
+
options,
|
|
22
|
+
));
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -55,8 +55,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
55
55
|
export const SDK_METADATA = {
|
|
56
56
|
language: "typescript",
|
|
57
57
|
openapiDocVersion: "1.0.0",
|
|
58
|
-
sdkVersion: "1.9.
|
|
58
|
+
sdkVersion: "1.9.19",
|
|
59
59
|
genVersion: "2.548.6",
|
|
60
60
|
userAgent:
|
|
61
|
-
"speakeasy-sdk/typescript 1.9.
|
|
61
|
+
"speakeasy-sdk/typescript 1.9.19 2.548.6 1.0.0 @mistralai/mistralai",
|
|
62
62
|
} as const;
|
|
@@ -15,6 +15,11 @@ export const ApiEndpoint = {
|
|
|
15
15
|
RootV1FimCompletions: "/v1/fim/completions",
|
|
16
16
|
RootV1Moderations: "/v1/moderations",
|
|
17
17
|
RootV1ChatModerations: "/v1/chat/moderations",
|
|
18
|
+
RootV1Ocr: "/v1/ocr",
|
|
19
|
+
RootV1Classifications: "/v1/classifications",
|
|
20
|
+
RootV1ChatClassifications: "/v1/chat/classifications",
|
|
21
|
+
RootV1Conversations: "/v1/conversations",
|
|
22
|
+
RootV1AudioTranscriptions: "/v1/audio/transcriptions",
|
|
18
23
|
} as const;
|
|
19
24
|
export type ApiEndpoint = OpenEnum<typeof ApiEndpoint>;
|
|
20
25
|
|
|
@@ -12,6 +12,11 @@ import {
|
|
|
12
12
|
EmbeddingDtype$inboundSchema,
|
|
13
13
|
EmbeddingDtype$outboundSchema,
|
|
14
14
|
} from "./embeddingdtype.js";
|
|
15
|
+
import {
|
|
16
|
+
EncodingFormat,
|
|
17
|
+
EncodingFormat$inboundSchema,
|
|
18
|
+
EncodingFormat$outboundSchema,
|
|
19
|
+
} from "./encodingformat.js";
|
|
15
20
|
|
|
16
21
|
/**
|
|
17
22
|
* Text to embed.
|
|
@@ -32,6 +37,7 @@ export type EmbeddingRequest = {
|
|
|
32
37
|
*/
|
|
33
38
|
outputDimension?: number | null | undefined;
|
|
34
39
|
outputDtype?: EmbeddingDtype | undefined;
|
|
40
|
+
encodingFormat?: EncodingFormat | undefined;
|
|
35
41
|
};
|
|
36
42
|
|
|
37
43
|
/** @internal */
|
|
@@ -92,11 +98,13 @@ export const EmbeddingRequest$inboundSchema: z.ZodType<
|
|
|
92
98
|
input: z.union([z.string(), z.array(z.string())]),
|
|
93
99
|
output_dimension: z.nullable(z.number().int()).optional(),
|
|
94
100
|
output_dtype: EmbeddingDtype$inboundSchema.optional(),
|
|
101
|
+
encoding_format: EncodingFormat$inboundSchema.optional(),
|
|
95
102
|
}).transform((v) => {
|
|
96
103
|
return remap$(v, {
|
|
97
104
|
"input": "inputs",
|
|
98
105
|
"output_dimension": "outputDimension",
|
|
99
106
|
"output_dtype": "outputDtype",
|
|
107
|
+
"encoding_format": "encodingFormat",
|
|
100
108
|
});
|
|
101
109
|
});
|
|
102
110
|
|
|
@@ -106,6 +114,7 @@ export type EmbeddingRequest$Outbound = {
|
|
|
106
114
|
input: string | Array<string>;
|
|
107
115
|
output_dimension?: number | null | undefined;
|
|
108
116
|
output_dtype?: string | undefined;
|
|
117
|
+
encoding_format?: string | undefined;
|
|
109
118
|
};
|
|
110
119
|
|
|
111
120
|
/** @internal */
|
|
@@ -118,11 +127,13 @@ export const EmbeddingRequest$outboundSchema: z.ZodType<
|
|
|
118
127
|
inputs: z.union([z.string(), z.array(z.string())]),
|
|
119
128
|
outputDimension: z.nullable(z.number().int()).optional(),
|
|
120
129
|
outputDtype: EmbeddingDtype$outboundSchema.optional(),
|
|
130
|
+
encodingFormat: EncodingFormat$outboundSchema.optional(),
|
|
121
131
|
}).transform((v) => {
|
|
122
132
|
return remap$(v, {
|
|
123
133
|
inputs: "input",
|
|
124
134
|
outputDimension: "output_dimension",
|
|
125
135
|
outputDtype: "output_dtype",
|
|
136
|
+
encodingFormat: "encoding_format",
|
|
126
137
|
});
|
|
127
138
|
});
|
|
128
139
|
|
|
@@ -0,0 +1,33 @@
|
|
|
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 EncodingFormat = {
|
|
9
|
+
Float: "float",
|
|
10
|
+
Base64: "base64",
|
|
11
|
+
} as const;
|
|
12
|
+
export type EncodingFormat = ClosedEnum<typeof EncodingFormat>;
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const EncodingFormat$inboundSchema: z.ZodNativeEnum<
|
|
16
|
+
typeof EncodingFormat
|
|
17
|
+
> = z.nativeEnum(EncodingFormat);
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const EncodingFormat$outboundSchema: z.ZodNativeEnum<
|
|
21
|
+
typeof EncodingFormat
|
|
22
|
+
> = EncodingFormat$inboundSchema;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
27
|
+
*/
|
|
28
|
+
export namespace EncodingFormat$ {
|
|
29
|
+
/** @deprecated use `EncodingFormat$inboundSchema` instead. */
|
|
30
|
+
export const inboundSchema = EncodingFormat$inboundSchema;
|
|
31
|
+
/** @deprecated use `EncodingFormat$outboundSchema` instead. */
|
|
32
|
+
export const outboundSchema = EncodingFormat$outboundSchema;
|
|
33
|
+
}
|
|
@@ -77,6 +77,7 @@ export * from "./embeddingdtype.js";
|
|
|
77
77
|
export * from "./embeddingrequest.js";
|
|
78
78
|
export * from "./embeddingresponse.js";
|
|
79
79
|
export * from "./embeddingresponsedata.js";
|
|
80
|
+
export * from "./encodingformat.js";
|
|
80
81
|
export * from "./entitytype.js";
|
|
81
82
|
export * from "./eventout.js";
|
|
82
83
|
export * from "./file.js";
|
|
@@ -158,6 +159,7 @@ export * from "./sharingout.js";
|
|
|
158
159
|
export * from "./source.js";
|
|
159
160
|
export * from "./ssetypes.js";
|
|
160
161
|
export * from "./systemmessage.js";
|
|
162
|
+
export * from "./systemmessagecontentchunks.js";
|
|
161
163
|
export * from "./textchunk.js";
|
|
162
164
|
export * from "./thinkchunk.js";
|
|
163
165
|
export * from "./timestampgranularity.js";
|
|
@@ -24,6 +24,12 @@ import {
|
|
|
24
24
|
TextChunk$Outbound,
|
|
25
25
|
TextChunk$outboundSchema,
|
|
26
26
|
} from "./textchunk.js";
|
|
27
|
+
import {
|
|
28
|
+
ThinkChunk,
|
|
29
|
+
ThinkChunk$inboundSchema,
|
|
30
|
+
ThinkChunk$Outbound,
|
|
31
|
+
ThinkChunk$outboundSchema,
|
|
32
|
+
} from "./thinkchunk.js";
|
|
27
33
|
import {
|
|
28
34
|
ToolFileChunk,
|
|
29
35
|
ToolFileChunk$inboundSchema,
|
|
@@ -35,6 +41,7 @@ export type MessageInputContentChunks =
|
|
|
35
41
|
| TextChunk
|
|
36
42
|
| ImageURLChunk
|
|
37
43
|
| DocumentURLChunk
|
|
44
|
+
| ThinkChunk
|
|
38
45
|
| ToolFileChunk;
|
|
39
46
|
|
|
40
47
|
/** @internal */
|
|
@@ -46,6 +53,7 @@ export const MessageInputContentChunks$inboundSchema: z.ZodType<
|
|
|
46
53
|
TextChunk$inboundSchema,
|
|
47
54
|
ImageURLChunk$inboundSchema,
|
|
48
55
|
DocumentURLChunk$inboundSchema,
|
|
56
|
+
ThinkChunk$inboundSchema,
|
|
49
57
|
ToolFileChunk$inboundSchema,
|
|
50
58
|
]);
|
|
51
59
|
|
|
@@ -54,6 +62,7 @@ export type MessageInputContentChunks$Outbound =
|
|
|
54
62
|
| TextChunk$Outbound
|
|
55
63
|
| ImageURLChunk$Outbound
|
|
56
64
|
| DocumentURLChunk$Outbound
|
|
65
|
+
| ThinkChunk$Outbound
|
|
57
66
|
| ToolFileChunk$Outbound;
|
|
58
67
|
|
|
59
68
|
/** @internal */
|
|
@@ -65,6 +74,7 @@ export const MessageInputContentChunks$outboundSchema: z.ZodType<
|
|
|
65
74
|
TextChunk$outboundSchema,
|
|
66
75
|
ImageURLChunk$outboundSchema,
|
|
67
76
|
DocumentURLChunk$outboundSchema,
|
|
77
|
+
ThinkChunk$outboundSchema,
|
|
68
78
|
ToolFileChunk$outboundSchema,
|
|
69
79
|
]);
|
|
70
80
|
|
|
@@ -8,13 +8,13 @@ import { ClosedEnum } from "../../types/enums.js";
|
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from "./
|
|
11
|
+
SystemMessageContentChunks,
|
|
12
|
+
SystemMessageContentChunks$inboundSchema,
|
|
13
|
+
SystemMessageContentChunks$Outbound,
|
|
14
|
+
SystemMessageContentChunks$outboundSchema,
|
|
15
|
+
} from "./systemmessagecontentchunks.js";
|
|
16
16
|
|
|
17
|
-
export type SystemMessageContent = string | Array<
|
|
17
|
+
export type SystemMessageContent = string | Array<SystemMessageContentChunks>;
|
|
18
18
|
|
|
19
19
|
export const Role = {
|
|
20
20
|
System: "system",
|
|
@@ -22,7 +22,7 @@ export const Role = {
|
|
|
22
22
|
export type Role = ClosedEnum<typeof Role>;
|
|
23
23
|
|
|
24
24
|
export type SystemMessage = {
|
|
25
|
-
content: string | Array<
|
|
25
|
+
content: string | Array<SystemMessageContentChunks>;
|
|
26
26
|
role?: Role | undefined;
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -31,17 +31,19 @@ export const SystemMessageContent$inboundSchema: z.ZodType<
|
|
|
31
31
|
SystemMessageContent,
|
|
32
32
|
z.ZodTypeDef,
|
|
33
33
|
unknown
|
|
34
|
-
> = z.union([z.string(), z.array(
|
|
34
|
+
> = z.union([z.string(), z.array(SystemMessageContentChunks$inboundSchema)]);
|
|
35
35
|
|
|
36
36
|
/** @internal */
|
|
37
|
-
export type SystemMessageContent$Outbound =
|
|
37
|
+
export type SystemMessageContent$Outbound =
|
|
38
|
+
| string
|
|
39
|
+
| Array<SystemMessageContentChunks$Outbound>;
|
|
38
40
|
|
|
39
41
|
/** @internal */
|
|
40
42
|
export const SystemMessageContent$outboundSchema: z.ZodType<
|
|
41
43
|
SystemMessageContent$Outbound,
|
|
42
44
|
z.ZodTypeDef,
|
|
43
45
|
SystemMessageContent
|
|
44
|
-
> = z.union([z.string(), z.array(
|
|
46
|
+
> = z.union([z.string(), z.array(SystemMessageContentChunks$outboundSchema)]);
|
|
45
47
|
|
|
46
48
|
/**
|
|
47
49
|
* @internal
|
|
@@ -100,13 +102,16 @@ export const SystemMessage$inboundSchema: z.ZodType<
|
|
|
100
102
|
z.ZodTypeDef,
|
|
101
103
|
unknown
|
|
102
104
|
> = z.object({
|
|
103
|
-
content: z.union([
|
|
105
|
+
content: z.union([
|
|
106
|
+
z.string(),
|
|
107
|
+
z.array(SystemMessageContentChunks$inboundSchema),
|
|
108
|
+
]),
|
|
104
109
|
role: Role$inboundSchema.default("system"),
|
|
105
110
|
});
|
|
106
111
|
|
|
107
112
|
/** @internal */
|
|
108
113
|
export type SystemMessage$Outbound = {
|
|
109
|
-
content: string | Array<
|
|
114
|
+
content: string | Array<SystemMessageContentChunks$Outbound>;
|
|
110
115
|
role: string;
|
|
111
116
|
};
|
|
112
117
|
|
|
@@ -116,7 +121,10 @@ export const SystemMessage$outboundSchema: z.ZodType<
|
|
|
116
121
|
z.ZodTypeDef,
|
|
117
122
|
SystemMessage
|
|
118
123
|
> = z.object({
|
|
119
|
-
content: z.union([
|
|
124
|
+
content: z.union([
|
|
125
|
+
z.string(),
|
|
126
|
+
z.array(SystemMessageContentChunks$outboundSchema),
|
|
127
|
+
]),
|
|
120
128
|
role: Role$outboundSchema.default("system"),
|
|
121
129
|
});
|
|
122
130
|
|
|
@@ -0,0 +1,92 @@
|
|
|
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 { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
TextChunk,
|
|
11
|
+
TextChunk$inboundSchema,
|
|
12
|
+
TextChunk$Outbound,
|
|
13
|
+
TextChunk$outboundSchema,
|
|
14
|
+
} from "./textchunk.js";
|
|
15
|
+
import {
|
|
16
|
+
ThinkChunk,
|
|
17
|
+
ThinkChunk$inboundSchema,
|
|
18
|
+
ThinkChunk$Outbound,
|
|
19
|
+
ThinkChunk$outboundSchema,
|
|
20
|
+
} from "./thinkchunk.js";
|
|
21
|
+
|
|
22
|
+
export type SystemMessageContentChunks =
|
|
23
|
+
| (TextChunk & { type: "text" })
|
|
24
|
+
| (ThinkChunk & { type: "thinking" });
|
|
25
|
+
|
|
26
|
+
/** @internal */
|
|
27
|
+
export const SystemMessageContentChunks$inboundSchema: z.ZodType<
|
|
28
|
+
SystemMessageContentChunks,
|
|
29
|
+
z.ZodTypeDef,
|
|
30
|
+
unknown
|
|
31
|
+
> = z.union([
|
|
32
|
+
TextChunk$inboundSchema.and(
|
|
33
|
+
z.object({ type: z.literal("text") }).transform((v) => ({ type: v.type })),
|
|
34
|
+
),
|
|
35
|
+
ThinkChunk$inboundSchema.and(
|
|
36
|
+
z.object({ type: z.literal("thinking") }).transform((v) => ({
|
|
37
|
+
type: v.type,
|
|
38
|
+
})),
|
|
39
|
+
),
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export type SystemMessageContentChunks$Outbound =
|
|
44
|
+
| (TextChunk$Outbound & { type: "text" })
|
|
45
|
+
| (ThinkChunk$Outbound & { type: "thinking" });
|
|
46
|
+
|
|
47
|
+
/** @internal */
|
|
48
|
+
export const SystemMessageContentChunks$outboundSchema: z.ZodType<
|
|
49
|
+
SystemMessageContentChunks$Outbound,
|
|
50
|
+
z.ZodTypeDef,
|
|
51
|
+
SystemMessageContentChunks
|
|
52
|
+
> = z.union([
|
|
53
|
+
TextChunk$outboundSchema.and(
|
|
54
|
+
z.object({ type: z.literal("text") }).transform((v) => ({ type: v.type })),
|
|
55
|
+
),
|
|
56
|
+
ThinkChunk$outboundSchema.and(
|
|
57
|
+
z.object({ type: z.literal("thinking") }).transform((v) => ({
|
|
58
|
+
type: v.type,
|
|
59
|
+
})),
|
|
60
|
+
),
|
|
61
|
+
]);
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
66
|
+
*/
|
|
67
|
+
export namespace SystemMessageContentChunks$ {
|
|
68
|
+
/** @deprecated use `SystemMessageContentChunks$inboundSchema` instead. */
|
|
69
|
+
export const inboundSchema = SystemMessageContentChunks$inboundSchema;
|
|
70
|
+
/** @deprecated use `SystemMessageContentChunks$outboundSchema` instead. */
|
|
71
|
+
export const outboundSchema = SystemMessageContentChunks$outboundSchema;
|
|
72
|
+
/** @deprecated use `SystemMessageContentChunks$Outbound` instead. */
|
|
73
|
+
export type Outbound = SystemMessageContentChunks$Outbound;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function systemMessageContentChunksToJSON(
|
|
77
|
+
systemMessageContentChunks: SystemMessageContentChunks,
|
|
78
|
+
): string {
|
|
79
|
+
return JSON.stringify(
|
|
80
|
+
SystemMessageContentChunks$outboundSchema.parse(systemMessageContentChunks),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function systemMessageContentChunksFromJSON(
|
|
85
|
+
jsonString: string,
|
|
86
|
+
): SafeParseResult<SystemMessageContentChunks, SDKValidationError> {
|
|
87
|
+
return safeParse(
|
|
88
|
+
jsonString,
|
|
89
|
+
(x) => SystemMessageContentChunks$inboundSchema.parse(JSON.parse(x)),
|
|
90
|
+
`Failed to parse 'SystemMessageContentChunks' from JSON`,
|
|
91
|
+
);
|
|
92
|
+
}
|