@openrouter/sdk 0.1.27 → 0.2.9
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/biome.json +171 -0
- package/esm/funcs/callModel.d.ts +7 -7
- package/esm/funcs/callModel.js +35 -23
- package/esm/funcs/embeddingsGenerate.js +2 -4
- package/esm/funcs/oAuthCreateAuthorizationUrl.d.ts +3 -3
- package/esm/funcs/oAuthCreateAuthorizationUrl.js +30 -14
- package/esm/funcs/oAuthCreateSHA256CodeChallenge.d.ts +2 -2
- package/esm/funcs/oAuthCreateSHA256CodeChallenge.js +13 -12
- package/esm/hooks/registration.d.ts +2 -2
- package/esm/hooks/registration.js +1 -2
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/lib/encodings.d.ts +1 -0
- package/esm/lib/encodings.js +12 -1
- package/esm/lib/response-wrapper.d.ts +17 -5
- package/esm/lib/response-wrapper.js +119 -68
- package/esm/lib/reusable-stream.js +26 -7
- package/esm/lib/stream-transformers.d.ts +3 -3
- package/esm/lib/stream-transformers.js +43 -41
- package/esm/lib/tool-executor.d.ts +9 -9
- package/esm/lib/tool-executor.js +9 -9
- package/esm/lib/tool-orchestrator.d.ts +3 -3
- package/esm/lib/tool-orchestrator.js +39 -19
- package/esm/lib/tool-types.d.ts +26 -25
- package/esm/lib/tool-types.js +3 -3
- package/esm/models/chatcompletionfinishreason.d.ts +13 -0
- package/esm/models/chatcompletionfinishreason.js +14 -0
- package/esm/models/chatgenerationparams.d.ts +16 -4
- package/esm/models/chatgenerationparams.js +16 -4
- package/esm/models/chatmessagecontentitem.d.ts +2 -19
- package/esm/models/chatmessagecontentitem.js +6 -9
- package/esm/models/chatmessagecontentitemaudio.d.ts +1 -16
- package/esm/models/chatmessagecontentitemaudio.js +2 -16
- package/esm/models/chatmessagecontentitemcachecontrol.d.ts +29 -0
- package/esm/models/chatmessagecontentitemcachecontrol.js +33 -0
- package/esm/models/chatmessagecontentitemtext.d.ts +3 -0
- package/esm/models/chatmessagecontentitemtext.js +12 -0
- package/esm/models/chatmessagecontentitemvideo.d.ts +23 -11
- package/esm/models/chatmessagecontentitemvideo.js +24 -11
- package/esm/models/chatresponsechoice.d.ts +1 -21
- package/esm/models/chatresponsechoice.js +1 -25
- package/esm/models/chatstreamingchoice.d.ts +16 -0
- package/esm/models/chatstreamingchoice.js +24 -0
- package/esm/models/chatstreamingresponsechunk.d.ts +1 -1
- package/esm/models/chatstreamingresponsechunk.js +1 -1
- package/esm/models/completionchoice.d.ts +2 -0
- package/esm/models/completionchoice.js +3 -0
- package/esm/models/completioncreateparams.d.ts +4 -4
- package/esm/models/completioncreateparams.js +4 -4
- package/esm/models/completionresponse.d.ts +1 -0
- package/esm/models/completionresponse.js +1 -0
- package/esm/models/filecitation.d.ts +2 -11
- package/esm/models/filecitation.js +2 -9
- package/esm/models/filepath.d.ts +2 -11
- package/esm/models/filepath.js +2 -10
- package/esm/models/index.d.ts +3 -2
- package/esm/models/index.js +3 -2
- package/esm/models/message.d.ts +2 -2
- package/esm/models/message.js +1 -1
- package/esm/models/openairesponsesannotation.d.ts +2 -2
- package/esm/models/openairesponsesannotation.js +2 -2
- package/esm/models/openairesponsesinputunion.d.ts +5 -45
- package/esm/models/openairesponsesinputunion.js +20 -20
- package/esm/models/openairesponsesrefusalcontent.d.ts +2 -11
- package/esm/models/openairesponsesrefusalcontent.js +2 -9
- package/esm/models/openresponseseasyinputmessage.d.ts +6 -54
- package/esm/models/openresponseseasyinputmessage.js +12 -12
- package/esm/models/openresponseserrorevent.d.ts +1 -8
- package/esm/models/openresponseserrorevent.js +1 -6
- package/esm/models/openresponsesimagegencallcompleted.d.ts +1 -8
- package/esm/models/openresponsesimagegencallcompleted.js +1 -6
- package/esm/models/openresponsesimagegencallgenerating.d.ts +1 -8
- package/esm/models/openresponsesimagegencallgenerating.js +1 -6
- package/esm/models/openresponsesimagegencallinprogress.d.ts +1 -8
- package/esm/models/openresponsesimagegencallinprogress.js +1 -6
- package/esm/models/openresponsesimagegencallpartialimage.d.ts +1 -8
- package/esm/models/openresponsesimagegencallpartialimage.js +1 -6
- package/esm/models/openresponsesinputmessageitem.d.ts +4 -36
- package/esm/models/openresponsesinputmessageitem.js +8 -8
- package/esm/models/openresponsesnonstreamingresponse.d.ts +1 -7
- package/esm/models/openresponsesnonstreamingresponse.js +1 -6
- package/esm/models/openresponsesreasoningdeltaevent.d.ts +1 -8
- package/esm/models/openresponsesreasoningdeltaevent.js +1 -6
- package/esm/models/openresponsesreasoningdoneevent.d.ts +1 -8
- package/esm/models/openresponsesreasoningdoneevent.js +1 -6
- package/esm/models/openresponsesreasoningsummarypartaddedevent.d.ts +1 -8
- package/esm/models/openresponsesreasoningsummarypartaddedevent.js +1 -6
- package/esm/models/openresponsesreasoningsummarytextdeltaevent.d.ts +1 -8
- package/esm/models/openresponsesreasoningsummarytextdeltaevent.js +1 -6
- package/esm/models/openresponsesreasoningsummarytextdoneevent.d.ts +1 -8
- package/esm/models/openresponsesreasoningsummarytextdoneevent.js +1 -6
- package/esm/models/openresponsesrequest.d.ts +26 -44
- package/esm/models/openresponsesrequest.js +15 -32
- package/esm/models/openresponsesstreamevent.d.ts +30 -125
- package/esm/models/openresponsesstreamevent.js +34 -119
- package/esm/models/openresponseswebsearch20250826tool.d.ts +2 -11
- package/esm/models/openresponseswebsearch20250826tool.js +2 -9
- package/esm/models/openresponseswebsearchpreview20250311tool.d.ts +2 -11
- package/esm/models/openresponseswebsearchpreview20250311tool.js +2 -9
- package/esm/models/openresponseswebsearchpreviewtool.d.ts +2 -11
- package/esm/models/openresponseswebsearchpreviewtool.js +2 -9
- package/esm/models/openresponseswebsearchtool.d.ts +2 -11
- package/esm/models/openresponseswebsearchtool.js +2 -9
- package/esm/models/operations/createembeddings.d.ts +5 -21
- package/esm/models/operations/createembeddings.js +3 -22
- package/esm/models/operations/getcredits.d.ts +16 -1
- package/esm/models/operations/getcredits.js +17 -1
- package/esm/models/operations/getparameters.d.ts +5 -1
- package/esm/models/operations/getparameters.js +5 -1
- package/esm/models/providername.d.ts +5 -1
- package/esm/models/providername.js +5 -1
- package/esm/models/responseformattextconfig.d.ts +2 -2
- package/esm/models/responseformattextconfig.js +2 -2
- package/esm/models/responseinputaudio.d.ts +3 -11
- package/esm/models/responseinputaudio.js +2 -9
- package/esm/models/responseinputfile.d.ts +2 -11
- package/esm/models/responseinputfile.js +2 -9
- package/esm/models/responseinputimage.d.ts +3 -11
- package/esm/models/responseinputimage.js +2 -9
- package/esm/models/responseinputtext.d.ts +2 -11
- package/esm/models/responseinputtext.js +2 -9
- package/esm/models/responseoutputtext.d.ts +2 -11
- package/esm/models/responseoutputtext.js +2 -9
- package/esm/models/responsesformatjsonobject.d.ts +2 -11
- package/esm/models/responsesformatjsonobject.js +2 -9
- package/esm/models/responsesformattext.d.ts +2 -11
- package/esm/models/responsesformattext.js +2 -9
- package/esm/models/responsesformattextjsonschemaconfig.d.ts +2 -11
- package/esm/models/responsesformattextjsonschemaconfig.js +2 -9
- package/esm/models/responsesoutputitem.d.ts +13 -1
- package/esm/models/responsesoutputitem.js +6 -6
- package/esm/models/urlcitation.d.ts +2 -11
- package/esm/models/urlcitation.js +2 -9
- package/esm/sdk/oauth.d.ts +2 -2
- package/esm/sdk/oauth.js +2 -3
- package/esm/sdk/sdk.d.ts +9 -8
- package/esm/types/unrecognized.d.ts +7 -1
- package/esm/types/unrecognized.js +9 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/tsconfig.json +0 -1
- package/vitest.config.ts +14 -8
- package/esm/models/chatmessagecontentitemfile.d.ts +0 -36
- package/esm/models/chatmessagecontentitemfile.js +0 -51
- package/esm/models/videourl.d.ts +0 -17
- package/esm/models/videourl.js +0 -21
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as openEnums from "../types/enums.js";
|
|
5
|
+
export const ChatCompletionFinishReason = {
|
|
6
|
+
ToolCalls: "tool_calls",
|
|
7
|
+
Stop: "stop",
|
|
8
|
+
Length: "length",
|
|
9
|
+
ContentFilter: "content_filter",
|
|
10
|
+
Error: "error",
|
|
11
|
+
};
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const ChatCompletionFinishReason$inboundSchema = openEnums.inboundSchema(ChatCompletionFinishReason);
|
|
14
|
+
//# sourceMappingURL=chatcompletionfinishreason.js.map
|
|
@@ -27,8 +27,11 @@ export type ChatGenerationParamsResponseFormatJSONObject = {
|
|
|
27
27
|
export type ChatGenerationParamsResponseFormatText = {
|
|
28
28
|
type: "text";
|
|
29
29
|
};
|
|
30
|
-
export type ChatGenerationParamsResponseFormatUnion =
|
|
30
|
+
export type ChatGenerationParamsResponseFormatUnion = ChatGenerationParamsResponseFormatText | ChatGenerationParamsResponseFormatJSONObject | ResponseFormatJSONSchema | ResponseFormatTextGrammar | ChatGenerationParamsResponseFormatPython;
|
|
31
31
|
export type ChatGenerationParamsStop = string | Array<string>;
|
|
32
|
+
export type Debug = {
|
|
33
|
+
echoUpstreamBody?: boolean | undefined;
|
|
34
|
+
};
|
|
32
35
|
export type ChatGenerationParams = {
|
|
33
36
|
messages: Array<Message>;
|
|
34
37
|
model?: string | undefined;
|
|
@@ -46,7 +49,7 @@ export type ChatGenerationParams = {
|
|
|
46
49
|
} | undefined;
|
|
47
50
|
presencePenalty?: number | null | undefined;
|
|
48
51
|
reasoning?: Reasoning | undefined;
|
|
49
|
-
responseFormat?:
|
|
52
|
+
responseFormat?: ChatGenerationParamsResponseFormatText | ChatGenerationParamsResponseFormatJSONObject | ResponseFormatJSONSchema | ResponseFormatTextGrammar | ChatGenerationParamsResponseFormatPython | undefined;
|
|
50
53
|
seed?: number | null | undefined;
|
|
51
54
|
stop?: string | Array<string> | null | undefined;
|
|
52
55
|
stream?: boolean | undefined;
|
|
@@ -56,6 +59,7 @@ export type ChatGenerationParams = {
|
|
|
56
59
|
tools?: Array<ToolDefinitionJson> | undefined;
|
|
57
60
|
topP?: number | null | undefined;
|
|
58
61
|
user?: string | undefined;
|
|
62
|
+
debug?: Debug | undefined;
|
|
59
63
|
};
|
|
60
64
|
/** @internal */
|
|
61
65
|
export declare const Effort$outboundSchema: z.ZodType<string, Effort>;
|
|
@@ -89,7 +93,7 @@ export type ChatGenerationParamsResponseFormatText$Outbound = {
|
|
|
89
93
|
export declare const ChatGenerationParamsResponseFormatText$outboundSchema: z.ZodType<ChatGenerationParamsResponseFormatText$Outbound, ChatGenerationParamsResponseFormatText>;
|
|
90
94
|
export declare function chatGenerationParamsResponseFormatTextToJSON(chatGenerationParamsResponseFormatText: ChatGenerationParamsResponseFormatText): string;
|
|
91
95
|
/** @internal */
|
|
92
|
-
export type ChatGenerationParamsResponseFormatUnion$Outbound =
|
|
96
|
+
export type ChatGenerationParamsResponseFormatUnion$Outbound = ChatGenerationParamsResponseFormatText$Outbound | ChatGenerationParamsResponseFormatJSONObject$Outbound | ResponseFormatJSONSchema$Outbound | ResponseFormatTextGrammar$Outbound | ChatGenerationParamsResponseFormatPython$Outbound;
|
|
93
97
|
/** @internal */
|
|
94
98
|
export declare const ChatGenerationParamsResponseFormatUnion$outboundSchema: z.ZodType<ChatGenerationParamsResponseFormatUnion$Outbound, ChatGenerationParamsResponseFormatUnion>;
|
|
95
99
|
export declare function chatGenerationParamsResponseFormatUnionToJSON(chatGenerationParamsResponseFormatUnion: ChatGenerationParamsResponseFormatUnion): string;
|
|
@@ -99,6 +103,13 @@ export type ChatGenerationParamsStop$Outbound = string | Array<string>;
|
|
|
99
103
|
export declare const ChatGenerationParamsStop$outboundSchema: z.ZodType<ChatGenerationParamsStop$Outbound, ChatGenerationParamsStop>;
|
|
100
104
|
export declare function chatGenerationParamsStopToJSON(chatGenerationParamsStop: ChatGenerationParamsStop): string;
|
|
101
105
|
/** @internal */
|
|
106
|
+
export type Debug$Outbound = {
|
|
107
|
+
echo_upstream_body?: boolean | undefined;
|
|
108
|
+
};
|
|
109
|
+
/** @internal */
|
|
110
|
+
export declare const Debug$outboundSchema: z.ZodType<Debug$Outbound, Debug>;
|
|
111
|
+
export declare function debugToJSON(debug: Debug): string;
|
|
112
|
+
/** @internal */
|
|
102
113
|
export type ChatGenerationParams$Outbound = {
|
|
103
114
|
messages: Array<Message$Outbound>;
|
|
104
115
|
model?: string | undefined;
|
|
@@ -116,7 +127,7 @@ export type ChatGenerationParams$Outbound = {
|
|
|
116
127
|
} | undefined;
|
|
117
128
|
presence_penalty?: number | null | undefined;
|
|
118
129
|
reasoning?: Reasoning$Outbound | undefined;
|
|
119
|
-
response_format?:
|
|
130
|
+
response_format?: ChatGenerationParamsResponseFormatText$Outbound | ChatGenerationParamsResponseFormatJSONObject$Outbound | ResponseFormatJSONSchema$Outbound | ResponseFormatTextGrammar$Outbound | ChatGenerationParamsResponseFormatPython$Outbound | undefined;
|
|
120
131
|
seed?: number | null | undefined;
|
|
121
132
|
stop?: string | Array<string> | null | undefined;
|
|
122
133
|
stream: boolean;
|
|
@@ -126,6 +137,7 @@ export type ChatGenerationParams$Outbound = {
|
|
|
126
137
|
tools?: Array<ToolDefinitionJson$Outbound> | undefined;
|
|
127
138
|
top_p?: number | null | undefined;
|
|
128
139
|
user?: string | undefined;
|
|
140
|
+
debug?: Debug$Outbound | undefined;
|
|
129
141
|
};
|
|
130
142
|
/** @internal */
|
|
131
143
|
export declare const ChatGenerationParams$outboundSchema: z.ZodType<ChatGenerationParams$Outbound, ChatGenerationParams>;
|
|
@@ -51,10 +51,10 @@ export function chatGenerationParamsResponseFormatTextToJSON(chatGenerationParam
|
|
|
51
51
|
}
|
|
52
52
|
/** @internal */
|
|
53
53
|
export const ChatGenerationParamsResponseFormatUnion$outboundSchema = z.union([
|
|
54
|
-
ResponseFormatJSONSchema$outboundSchema,
|
|
55
|
-
ResponseFormatTextGrammar$outboundSchema,
|
|
56
54
|
z.lazy(() => ChatGenerationParamsResponseFormatText$outboundSchema),
|
|
57
55
|
z.lazy(() => ChatGenerationParamsResponseFormatJSONObject$outboundSchema),
|
|
56
|
+
ResponseFormatJSONSchema$outboundSchema,
|
|
57
|
+
ResponseFormatTextGrammar$outboundSchema,
|
|
58
58
|
z.lazy(() => ChatGenerationParamsResponseFormatPython$outboundSchema),
|
|
59
59
|
]);
|
|
60
60
|
export function chatGenerationParamsResponseFormatUnionToJSON(chatGenerationParamsResponseFormatUnion) {
|
|
@@ -66,6 +66,17 @@ export function chatGenerationParamsStopToJSON(chatGenerationParamsStop) {
|
|
|
66
66
|
return JSON.stringify(ChatGenerationParamsStop$outboundSchema.parse(chatGenerationParamsStop));
|
|
67
67
|
}
|
|
68
68
|
/** @internal */
|
|
69
|
+
export const Debug$outboundSchema = z.object({
|
|
70
|
+
echoUpstreamBody: z.boolean().optional(),
|
|
71
|
+
}).transform((v) => {
|
|
72
|
+
return remap$(v, {
|
|
73
|
+
echoUpstreamBody: "echo_upstream_body",
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
export function debugToJSON(debug) {
|
|
77
|
+
return JSON.stringify(Debug$outboundSchema.parse(debug));
|
|
78
|
+
}
|
|
79
|
+
/** @internal */
|
|
69
80
|
export const ChatGenerationParams$outboundSchema = z.object({
|
|
70
81
|
messages: z.array(Message$outboundSchema),
|
|
71
82
|
model: z.string().optional(),
|
|
@@ -80,10 +91,10 @@ export const ChatGenerationParams$outboundSchema = z.object({
|
|
|
80
91
|
presencePenalty: z.nullable(z.number()).optional(),
|
|
81
92
|
reasoning: z.lazy(() => Reasoning$outboundSchema).optional(),
|
|
82
93
|
responseFormat: z.union([
|
|
83
|
-
ResponseFormatJSONSchema$outboundSchema,
|
|
84
|
-
ResponseFormatTextGrammar$outboundSchema,
|
|
85
94
|
z.lazy(() => ChatGenerationParamsResponseFormatText$outboundSchema),
|
|
86
95
|
z.lazy(() => ChatGenerationParamsResponseFormatJSONObject$outboundSchema),
|
|
96
|
+
ResponseFormatJSONSchema$outboundSchema,
|
|
97
|
+
ResponseFormatTextGrammar$outboundSchema,
|
|
87
98
|
z.lazy(() => ChatGenerationParamsResponseFormatPython$outboundSchema),
|
|
88
99
|
]).optional(),
|
|
89
100
|
seed: z.nullable(z.int()).optional(),
|
|
@@ -95,6 +106,7 @@ export const ChatGenerationParams$outboundSchema = z.object({
|
|
|
95
106
|
tools: z.array(ToolDefinitionJson$outboundSchema).optional(),
|
|
96
107
|
topP: z.nullable(z.number()).optional(),
|
|
97
108
|
user: z.string().optional(),
|
|
109
|
+
debug: z.lazy(() => Debug$outboundSchema).optional(),
|
|
98
110
|
}).transform((v) => {
|
|
99
111
|
return remap$(v, {
|
|
100
112
|
frequencyPenalty: "frequency_penalty",
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
3
|
import { ChatMessageContentItemAudio, ChatMessageContentItemAudio$Outbound } from "./chatmessagecontentitemaudio.js";
|
|
4
|
-
import { ChatMessageContentItemFile, ChatMessageContentItemFile$Outbound } from "./chatmessagecontentitemfile.js";
|
|
5
4
|
import { ChatMessageContentItemImage, ChatMessageContentItemImage$Outbound } from "./chatmessagecontentitemimage.js";
|
|
6
5
|
import { ChatMessageContentItemText, ChatMessageContentItemText$Outbound } from "./chatmessagecontentitemtext.js";
|
|
7
6
|
import { ChatMessageContentItemVideo, ChatMessageContentItemVideo$Outbound } from "./chatmessagecontentitemvideo.js";
|
|
8
7
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
9
|
-
export type ChatMessageContentItem =
|
|
10
|
-
type: "text";
|
|
11
|
-
}) | (ChatMessageContentItemImage & {
|
|
12
|
-
type: "image_url";
|
|
13
|
-
}) | (ChatMessageContentItemAudio & {
|
|
14
|
-
type: "input_audio";
|
|
15
|
-
}) | (ChatMessageContentItemFile & {
|
|
16
|
-
type: "file";
|
|
17
|
-
}) | (ChatMessageContentItemVideo & {
|
|
8
|
+
export type ChatMessageContentItem = ChatMessageContentItemText | ChatMessageContentItemImage | ChatMessageContentItemAudio | (ChatMessageContentItemVideo & {
|
|
18
9
|
type: "input_video";
|
|
19
10
|
}) | (ChatMessageContentItemVideo & {
|
|
20
11
|
type: "video_url";
|
|
@@ -22,15 +13,7 @@ export type ChatMessageContentItem = (ChatMessageContentItemText & {
|
|
|
22
13
|
/** @internal */
|
|
23
14
|
export declare const ChatMessageContentItem$inboundSchema: z.ZodType<ChatMessageContentItem, unknown>;
|
|
24
15
|
/** @internal */
|
|
25
|
-
export type ChatMessageContentItem$Outbound =
|
|
26
|
-
type: "text";
|
|
27
|
-
}) | (ChatMessageContentItemImage$Outbound & {
|
|
28
|
-
type: "image_url";
|
|
29
|
-
}) | (ChatMessageContentItemAudio$Outbound & {
|
|
30
|
-
type: "input_audio";
|
|
31
|
-
}) | (ChatMessageContentItemFile$Outbound & {
|
|
32
|
-
type: "file";
|
|
33
|
-
}) | (ChatMessageContentItemVideo$Outbound & {
|
|
16
|
+
export type ChatMessageContentItem$Outbound = ChatMessageContentItemText$Outbound | ChatMessageContentItemImage$Outbound | ChatMessageContentItemAudio$Outbound | (ChatMessageContentItemVideo$Outbound & {
|
|
34
17
|
type: "input_video";
|
|
35
18
|
}) | (ChatMessageContentItemVideo$Outbound & {
|
|
36
19
|
type: "video_url";
|
|
@@ -4,25 +4,22 @@
|
|
|
4
4
|
import * as z from "zod/v4";
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
import { ChatMessageContentItemAudio$inboundSchema, ChatMessageContentItemAudio$outboundSchema, } from "./chatmessagecontentitemaudio.js";
|
|
7
|
-
import { ChatMessageContentItemFile$inboundSchema, ChatMessageContentItemFile$outboundSchema, } from "./chatmessagecontentitemfile.js";
|
|
8
7
|
import { ChatMessageContentItemImage$inboundSchema, ChatMessageContentItemImage$outboundSchema, } from "./chatmessagecontentitemimage.js";
|
|
9
8
|
import { ChatMessageContentItemText$inboundSchema, ChatMessageContentItemText$outboundSchema, } from "./chatmessagecontentitemtext.js";
|
|
10
9
|
import { ChatMessageContentItemVideo$inboundSchema, ChatMessageContentItemVideo$outboundSchema, } from "./chatmessagecontentitemvideo.js";
|
|
11
10
|
/** @internal */
|
|
12
11
|
export const ChatMessageContentItem$inboundSchema = z.union([
|
|
13
|
-
ChatMessageContentItemText$inboundSchema
|
|
14
|
-
ChatMessageContentItemImage$inboundSchema
|
|
15
|
-
ChatMessageContentItemAudio$inboundSchema
|
|
16
|
-
ChatMessageContentItemFile$inboundSchema.and(z.object({ type: z.literal("file") })),
|
|
12
|
+
ChatMessageContentItemText$inboundSchema,
|
|
13
|
+
ChatMessageContentItemImage$inboundSchema,
|
|
14
|
+
ChatMessageContentItemAudio$inboundSchema,
|
|
17
15
|
ChatMessageContentItemVideo$inboundSchema.and(z.object({ type: z.literal("input_video") })),
|
|
18
16
|
z.lazy(() => ChatMessageContentItemVideo$inboundSchema).and(z.object({ type: z.literal("video_url") })),
|
|
19
17
|
]);
|
|
20
18
|
/** @internal */
|
|
21
19
|
export const ChatMessageContentItem$outboundSchema = z.union([
|
|
22
|
-
ChatMessageContentItemText$outboundSchema
|
|
23
|
-
ChatMessageContentItemImage$outboundSchema
|
|
24
|
-
ChatMessageContentItemAudio$outboundSchema
|
|
25
|
-
ChatMessageContentItemFile$outboundSchema.and(z.object({ type: z.literal("file") })),
|
|
20
|
+
ChatMessageContentItemText$outboundSchema,
|
|
21
|
+
ChatMessageContentItemImage$outboundSchema,
|
|
22
|
+
ChatMessageContentItemAudio$outboundSchema,
|
|
26
23
|
ChatMessageContentItemVideo$outboundSchema.and(z.object({ type: z.literal("input_video") })),
|
|
27
24
|
z.lazy(() => ChatMessageContentItemVideo$outboundSchema).and(z.object({ type: z.literal("video_url") })),
|
|
28
25
|
]);
|
|
@@ -1,30 +1,15 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import { OpenEnum } from "../types/enums.js";
|
|
3
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
3
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
-
export declare const ChatMessageContentItemAudioFormat: {
|
|
6
|
-
readonly Wav: "wav";
|
|
7
|
-
readonly Mp3: "mp3";
|
|
8
|
-
readonly Flac: "flac";
|
|
9
|
-
readonly M4a: "m4a";
|
|
10
|
-
readonly Ogg: "ogg";
|
|
11
|
-
readonly Pcm16: "pcm16";
|
|
12
|
-
readonly Pcm24: "pcm24";
|
|
13
|
-
};
|
|
14
|
-
export type ChatMessageContentItemAudioFormat = OpenEnum<typeof ChatMessageContentItemAudioFormat>;
|
|
15
4
|
export type ChatMessageContentItemAudioInputAudio = {
|
|
16
5
|
data: string;
|
|
17
|
-
format:
|
|
6
|
+
format: string;
|
|
18
7
|
};
|
|
19
8
|
export type ChatMessageContentItemAudio = {
|
|
20
9
|
type: "input_audio";
|
|
21
10
|
inputAudio: ChatMessageContentItemAudioInputAudio;
|
|
22
11
|
};
|
|
23
12
|
/** @internal */
|
|
24
|
-
export declare const ChatMessageContentItemAudioFormat$inboundSchema: z.ZodType<ChatMessageContentItemAudioFormat, unknown>;
|
|
25
|
-
/** @internal */
|
|
26
|
-
export declare const ChatMessageContentItemAudioFormat$outboundSchema: z.ZodType<string, ChatMessageContentItemAudioFormat>;
|
|
27
|
-
/** @internal */
|
|
28
13
|
export declare const ChatMessageContentItemAudioInputAudio$inboundSchema: z.ZodType<ChatMessageContentItemAudioInputAudio, unknown>;
|
|
29
14
|
/** @internal */
|
|
30
15
|
export type ChatMessageContentItemAudioInputAudio$Outbound = {
|
|
@@ -4,29 +4,15 @@
|
|
|
4
4
|
import * as z from "zod/v4";
|
|
5
5
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
|
-
import * as openEnums from "../types/enums.js";
|
|
8
|
-
export const ChatMessageContentItemAudioFormat = {
|
|
9
|
-
Wav: "wav",
|
|
10
|
-
Mp3: "mp3",
|
|
11
|
-
Flac: "flac",
|
|
12
|
-
M4a: "m4a",
|
|
13
|
-
Ogg: "ogg",
|
|
14
|
-
Pcm16: "pcm16",
|
|
15
|
-
Pcm24: "pcm24",
|
|
16
|
-
};
|
|
17
|
-
/** @internal */
|
|
18
|
-
export const ChatMessageContentItemAudioFormat$inboundSchema = openEnums.inboundSchema(ChatMessageContentItemAudioFormat);
|
|
19
|
-
/** @internal */
|
|
20
|
-
export const ChatMessageContentItemAudioFormat$outboundSchema = openEnums.outboundSchema(ChatMessageContentItemAudioFormat);
|
|
21
7
|
/** @internal */
|
|
22
8
|
export const ChatMessageContentItemAudioInputAudio$inboundSchema = z.object({
|
|
23
9
|
data: z.string(),
|
|
24
|
-
format:
|
|
10
|
+
format: z.string(),
|
|
25
11
|
});
|
|
26
12
|
/** @internal */
|
|
27
13
|
export const ChatMessageContentItemAudioInputAudio$outboundSchema = z.object({
|
|
28
14
|
data: z.string(),
|
|
29
|
-
format:
|
|
15
|
+
format: z.string(),
|
|
30
16
|
});
|
|
31
17
|
export function chatMessageContentItemAudioInputAudioToJSON(chatMessageContentItemAudioInputAudio) {
|
|
32
18
|
return JSON.stringify(ChatMessageContentItemAudioInputAudio$outboundSchema.parse(chatMessageContentItemAudioInputAudio));
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export declare const Ttl: {
|
|
6
|
+
readonly Fivem: "5m";
|
|
7
|
+
readonly Oneh: "1h";
|
|
8
|
+
};
|
|
9
|
+
export type Ttl = OpenEnum<typeof Ttl>;
|
|
10
|
+
export type ChatMessageContentItemCacheControl = {
|
|
11
|
+
type: "ephemeral";
|
|
12
|
+
ttl?: Ttl | undefined;
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare const Ttl$inboundSchema: z.ZodType<Ttl, unknown>;
|
|
16
|
+
/** @internal */
|
|
17
|
+
export declare const Ttl$outboundSchema: z.ZodType<string, Ttl>;
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const ChatMessageContentItemCacheControl$inboundSchema: z.ZodType<ChatMessageContentItemCacheControl, unknown>;
|
|
20
|
+
/** @internal */
|
|
21
|
+
export type ChatMessageContentItemCacheControl$Outbound = {
|
|
22
|
+
type: "ephemeral";
|
|
23
|
+
ttl?: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const ChatMessageContentItemCacheControl$outboundSchema: z.ZodType<ChatMessageContentItemCacheControl$Outbound, ChatMessageContentItemCacheControl>;
|
|
27
|
+
export declare function chatMessageContentItemCacheControlToJSON(chatMessageContentItemCacheControl: ChatMessageContentItemCacheControl): string;
|
|
28
|
+
export declare function chatMessageContentItemCacheControlFromJSON(jsonString: string): SafeParseResult<ChatMessageContentItemCacheControl, SDKValidationError>;
|
|
29
|
+
//# sourceMappingURL=chatmessagecontentitemcachecontrol.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4";
|
|
5
|
+
import { safeParse } from "../lib/schemas.js";
|
|
6
|
+
import * as openEnums from "../types/enums.js";
|
|
7
|
+
export const Ttl = {
|
|
8
|
+
Fivem: "5m",
|
|
9
|
+
Oneh: "1h",
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export const Ttl$inboundSchema = openEnums
|
|
13
|
+
.inboundSchema(Ttl);
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const Ttl$outboundSchema = openEnums
|
|
16
|
+
.outboundSchema(Ttl);
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const ChatMessageContentItemCacheControl$inboundSchema = z.object({
|
|
19
|
+
type: z.literal("ephemeral"),
|
|
20
|
+
ttl: Ttl$inboundSchema.optional(),
|
|
21
|
+
});
|
|
22
|
+
/** @internal */
|
|
23
|
+
export const ChatMessageContentItemCacheControl$outboundSchema = z.object({
|
|
24
|
+
type: z.literal("ephemeral"),
|
|
25
|
+
ttl: Ttl$outboundSchema.optional(),
|
|
26
|
+
});
|
|
27
|
+
export function chatMessageContentItemCacheControlToJSON(chatMessageContentItemCacheControl) {
|
|
28
|
+
return JSON.stringify(ChatMessageContentItemCacheControl$outboundSchema.parse(chatMessageContentItemCacheControl));
|
|
29
|
+
}
|
|
30
|
+
export function chatMessageContentItemCacheControlFromJSON(jsonString) {
|
|
31
|
+
return safeParse(jsonString, (x) => ChatMessageContentItemCacheControl$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatMessageContentItemCacheControl' from JSON`);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=chatmessagecontentitemcachecontrol.js.map
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { ChatMessageContentItemCacheControl, ChatMessageContentItemCacheControl$Outbound } from "./chatmessagecontentitemcachecontrol.js";
|
|
3
4
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
5
|
export type ChatMessageContentItemText = {
|
|
5
6
|
type: "text";
|
|
6
7
|
text: string;
|
|
8
|
+
cacheControl?: ChatMessageContentItemCacheControl | undefined;
|
|
7
9
|
};
|
|
8
10
|
/** @internal */
|
|
9
11
|
export declare const ChatMessageContentItemText$inboundSchema: z.ZodType<ChatMessageContentItemText, unknown>;
|
|
@@ -11,6 +13,7 @@ export declare const ChatMessageContentItemText$inboundSchema: z.ZodType<ChatMes
|
|
|
11
13
|
export type ChatMessageContentItemText$Outbound = {
|
|
12
14
|
type: "text";
|
|
13
15
|
text: string;
|
|
16
|
+
cache_control?: ChatMessageContentItemCacheControl$Outbound | undefined;
|
|
14
17
|
};
|
|
15
18
|
/** @internal */
|
|
16
19
|
export declare const ChatMessageContentItemText$outboundSchema: z.ZodType<ChatMessageContentItemText$Outbound, ChatMessageContentItemText>;
|
|
@@ -2,16 +2,28 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
import * as z from "zod/v4";
|
|
5
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
5
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ChatMessageContentItemCacheControl$inboundSchema, ChatMessageContentItemCacheControl$outboundSchema, } from "./chatmessagecontentitemcachecontrol.js";
|
|
6
8
|
/** @internal */
|
|
7
9
|
export const ChatMessageContentItemText$inboundSchema = z.object({
|
|
8
10
|
type: z.literal("text"),
|
|
9
11
|
text: z.string(),
|
|
12
|
+
cache_control: ChatMessageContentItemCacheControl$inboundSchema.optional(),
|
|
13
|
+
}).transform((v) => {
|
|
14
|
+
return remap$(v, {
|
|
15
|
+
"cache_control": "cacheControl",
|
|
16
|
+
});
|
|
10
17
|
});
|
|
11
18
|
/** @internal */
|
|
12
19
|
export const ChatMessageContentItemText$outboundSchema = z.object({
|
|
13
20
|
type: z.literal("text"),
|
|
14
21
|
text: z.string(),
|
|
22
|
+
cacheControl: ChatMessageContentItemCacheControl$outboundSchema.optional(),
|
|
23
|
+
}).transform((v) => {
|
|
24
|
+
return remap$(v, {
|
|
25
|
+
cacheControl: "cache_control",
|
|
26
|
+
});
|
|
15
27
|
});
|
|
16
28
|
export function chatMessageContentItemTextToJSON(chatMessageContentItemText) {
|
|
17
29
|
return JSON.stringify(ChatMessageContentItemText$outboundSchema.parse(chatMessageContentItemText));
|
|
@@ -1,46 +1,58 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
3
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
-
|
|
5
|
-
export type ChatMessageContentItemVideoVideoUrlVideoUrl = {
|
|
4
|
+
export type VideoUrl2 = {
|
|
6
5
|
url: string;
|
|
7
6
|
};
|
|
8
7
|
export type ChatMessageContentItemVideoVideoURL = {
|
|
9
8
|
type: "video_url";
|
|
10
|
-
videoUrl:
|
|
9
|
+
videoUrl: VideoUrl2;
|
|
10
|
+
};
|
|
11
|
+
export type VideoUrl1 = {
|
|
12
|
+
url: string;
|
|
11
13
|
};
|
|
12
14
|
export type ChatMessageContentItemVideoInputVideo = {
|
|
13
15
|
type: "input_video";
|
|
14
|
-
videoUrl:
|
|
16
|
+
videoUrl: VideoUrl1;
|
|
15
17
|
};
|
|
16
18
|
export type ChatMessageContentItemVideo = ChatMessageContentItemVideoInputVideo | ChatMessageContentItemVideoVideoURL;
|
|
17
19
|
/** @internal */
|
|
18
|
-
export declare const
|
|
20
|
+
export declare const VideoUrl2$inboundSchema: z.ZodType<VideoUrl2, unknown>;
|
|
19
21
|
/** @internal */
|
|
20
|
-
export type
|
|
22
|
+
export type VideoUrl2$Outbound = {
|
|
21
23
|
url: string;
|
|
22
24
|
};
|
|
23
25
|
/** @internal */
|
|
24
|
-
export declare const
|
|
25
|
-
export declare function
|
|
26
|
-
export declare function
|
|
26
|
+
export declare const VideoUrl2$outboundSchema: z.ZodType<VideoUrl2$Outbound, VideoUrl2>;
|
|
27
|
+
export declare function videoUrl2ToJSON(videoUrl2: VideoUrl2): string;
|
|
28
|
+
export declare function videoUrl2FromJSON(jsonString: string): SafeParseResult<VideoUrl2, SDKValidationError>;
|
|
27
29
|
/** @internal */
|
|
28
30
|
export declare const ChatMessageContentItemVideoVideoURL$inboundSchema: z.ZodType<ChatMessageContentItemVideoVideoURL, unknown>;
|
|
29
31
|
/** @internal */
|
|
30
32
|
export type ChatMessageContentItemVideoVideoURL$Outbound = {
|
|
31
33
|
type: "video_url";
|
|
32
|
-
video_url:
|
|
34
|
+
video_url: VideoUrl2$Outbound;
|
|
33
35
|
};
|
|
34
36
|
/** @internal */
|
|
35
37
|
export declare const ChatMessageContentItemVideoVideoURL$outboundSchema: z.ZodType<ChatMessageContentItemVideoVideoURL$Outbound, ChatMessageContentItemVideoVideoURL>;
|
|
36
38
|
export declare function chatMessageContentItemVideoVideoURLToJSON(chatMessageContentItemVideoVideoURL: ChatMessageContentItemVideoVideoURL): string;
|
|
37
39
|
export declare function chatMessageContentItemVideoVideoURLFromJSON(jsonString: string): SafeParseResult<ChatMessageContentItemVideoVideoURL, SDKValidationError>;
|
|
38
40
|
/** @internal */
|
|
41
|
+
export declare const VideoUrl1$inboundSchema: z.ZodType<VideoUrl1, unknown>;
|
|
42
|
+
/** @internal */
|
|
43
|
+
export type VideoUrl1$Outbound = {
|
|
44
|
+
url: string;
|
|
45
|
+
};
|
|
46
|
+
/** @internal */
|
|
47
|
+
export declare const VideoUrl1$outboundSchema: z.ZodType<VideoUrl1$Outbound, VideoUrl1>;
|
|
48
|
+
export declare function videoUrl1ToJSON(videoUrl1: VideoUrl1): string;
|
|
49
|
+
export declare function videoUrl1FromJSON(jsonString: string): SafeParseResult<VideoUrl1, SDKValidationError>;
|
|
50
|
+
/** @internal */
|
|
39
51
|
export declare const ChatMessageContentItemVideoInputVideo$inboundSchema: z.ZodType<ChatMessageContentItemVideoInputVideo, unknown>;
|
|
40
52
|
/** @internal */
|
|
41
53
|
export type ChatMessageContentItemVideoInputVideo$Outbound = {
|
|
42
54
|
type: "input_video";
|
|
43
|
-
video_url:
|
|
55
|
+
video_url: VideoUrl1$Outbound;
|
|
44
56
|
};
|
|
45
57
|
/** @internal */
|
|
46
58
|
export declare const ChatMessageContentItemVideoInputVideo$outboundSchema: z.ZodType<ChatMessageContentItemVideoInputVideo$Outbound, ChatMessageContentItemVideoInputVideo>;
|
|
@@ -4,25 +4,24 @@
|
|
|
4
4
|
import * as z from "zod/v4";
|
|
5
5
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
|
-
import { VideoURL$inboundSchema, VideoURL$outboundSchema, } from "./videourl.js";
|
|
8
7
|
/** @internal */
|
|
9
|
-
export const
|
|
8
|
+
export const VideoUrl2$inboundSchema = z.object({
|
|
10
9
|
url: z.string(),
|
|
11
10
|
});
|
|
12
11
|
/** @internal */
|
|
13
|
-
export const
|
|
12
|
+
export const VideoUrl2$outboundSchema = z.object({
|
|
14
13
|
url: z.string(),
|
|
15
14
|
});
|
|
16
|
-
export function
|
|
17
|
-
return JSON.stringify(
|
|
15
|
+
export function videoUrl2ToJSON(videoUrl2) {
|
|
16
|
+
return JSON.stringify(VideoUrl2$outboundSchema.parse(videoUrl2));
|
|
18
17
|
}
|
|
19
|
-
export function
|
|
20
|
-
return safeParse(jsonString, (x) =>
|
|
18
|
+
export function videoUrl2FromJSON(jsonString) {
|
|
19
|
+
return safeParse(jsonString, (x) => VideoUrl2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VideoUrl2' from JSON`);
|
|
21
20
|
}
|
|
22
21
|
/** @internal */
|
|
23
22
|
export const ChatMessageContentItemVideoVideoURL$inboundSchema = z.object({
|
|
24
23
|
type: z.literal("video_url"),
|
|
25
|
-
video_url: z.lazy(() =>
|
|
24
|
+
video_url: z.lazy(() => VideoUrl2$inboundSchema),
|
|
26
25
|
}).transform((v) => {
|
|
27
26
|
return remap$(v, {
|
|
28
27
|
"video_url": "videoUrl",
|
|
@@ -31,7 +30,7 @@ export const ChatMessageContentItemVideoVideoURL$inboundSchema = z.object({
|
|
|
31
30
|
/** @internal */
|
|
32
31
|
export const ChatMessageContentItemVideoVideoURL$outboundSchema = z.object({
|
|
33
32
|
type: z.literal("video_url"),
|
|
34
|
-
videoUrl: z.lazy(() =>
|
|
33
|
+
videoUrl: z.lazy(() => VideoUrl2$outboundSchema),
|
|
35
34
|
}).transform((v) => {
|
|
36
35
|
return remap$(v, {
|
|
37
36
|
videoUrl: "video_url",
|
|
@@ -44,9 +43,23 @@ export function chatMessageContentItemVideoVideoURLFromJSON(jsonString) {
|
|
|
44
43
|
return safeParse(jsonString, (x) => ChatMessageContentItemVideoVideoURL$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatMessageContentItemVideoVideoURL' from JSON`);
|
|
45
44
|
}
|
|
46
45
|
/** @internal */
|
|
46
|
+
export const VideoUrl1$inboundSchema = z.object({
|
|
47
|
+
url: z.string(),
|
|
48
|
+
});
|
|
49
|
+
/** @internal */
|
|
50
|
+
export const VideoUrl1$outboundSchema = z.object({
|
|
51
|
+
url: z.string(),
|
|
52
|
+
});
|
|
53
|
+
export function videoUrl1ToJSON(videoUrl1) {
|
|
54
|
+
return JSON.stringify(VideoUrl1$outboundSchema.parse(videoUrl1));
|
|
55
|
+
}
|
|
56
|
+
export function videoUrl1FromJSON(jsonString) {
|
|
57
|
+
return safeParse(jsonString, (x) => VideoUrl1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VideoUrl1' from JSON`);
|
|
58
|
+
}
|
|
59
|
+
/** @internal */
|
|
47
60
|
export const ChatMessageContentItemVideoInputVideo$inboundSchema = z.object({
|
|
48
61
|
type: z.literal("input_video"),
|
|
49
|
-
video_url:
|
|
62
|
+
video_url: z.lazy(() => VideoUrl1$inboundSchema),
|
|
50
63
|
}).transform((v) => {
|
|
51
64
|
return remap$(v, {
|
|
52
65
|
"video_url": "videoUrl",
|
|
@@ -55,7 +68,7 @@ export const ChatMessageContentItemVideoInputVideo$inboundSchema = z.object({
|
|
|
55
68
|
/** @internal */
|
|
56
69
|
export const ChatMessageContentItemVideoInputVideo$outboundSchema = z.object({
|
|
57
70
|
type: z.literal("input_video"),
|
|
58
|
-
videoUrl:
|
|
71
|
+
videoUrl: z.lazy(() => VideoUrl1$outboundSchema),
|
|
59
72
|
}).transform((v) => {
|
|
60
73
|
return remap$(v, {
|
|
61
74
|
videoUrl: "video_url",
|
|
@@ -1,36 +1,16 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import { OpenEnum } from "../types/enums.js";
|
|
3
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
3
|
import { AssistantMessage } from "./assistantmessage.js";
|
|
4
|
+
import { ChatCompletionFinishReason } from "./chatcompletionfinishreason.js";
|
|
5
5
|
import { ChatMessageTokenLogprobs } from "./chatmessagetokenlogprobs.js";
|
|
6
|
-
import { ChatStreamingMessageChunk } from "./chatstreamingmessagechunk.js";
|
|
7
6
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
8
|
-
export declare const ChatCompletionFinishReason: {
|
|
9
|
-
readonly ToolCalls: "tool_calls";
|
|
10
|
-
readonly Stop: "stop";
|
|
11
|
-
readonly Length: "length";
|
|
12
|
-
readonly ContentFilter: "content_filter";
|
|
13
|
-
readonly Error: "error";
|
|
14
|
-
};
|
|
15
|
-
export type ChatCompletionFinishReason = OpenEnum<typeof ChatCompletionFinishReason>;
|
|
16
7
|
export type ChatResponseChoice = {
|
|
17
8
|
finishReason: ChatCompletionFinishReason | null;
|
|
18
9
|
index: number;
|
|
19
10
|
message: AssistantMessage;
|
|
20
11
|
logprobs?: ChatMessageTokenLogprobs | null | undefined;
|
|
21
12
|
};
|
|
22
|
-
export type ChatStreamingChoice = {
|
|
23
|
-
delta: ChatStreamingMessageChunk;
|
|
24
|
-
finishReason: ChatCompletionFinishReason | null;
|
|
25
|
-
index: number;
|
|
26
|
-
logprobs?: ChatMessageTokenLogprobs | null | undefined;
|
|
27
|
-
};
|
|
28
|
-
/** @internal */
|
|
29
|
-
export declare const ChatCompletionFinishReason$inboundSchema: z.ZodType<ChatCompletionFinishReason, unknown>;
|
|
30
13
|
/** @internal */
|
|
31
14
|
export declare const ChatResponseChoice$inboundSchema: z.ZodType<ChatResponseChoice, unknown>;
|
|
32
15
|
export declare function chatResponseChoiceFromJSON(jsonString: string): SafeParseResult<ChatResponseChoice, SDKValidationError>;
|
|
33
|
-
/** @internal */
|
|
34
|
-
export declare const ChatStreamingChoice$inboundSchema: z.ZodType<ChatStreamingChoice, unknown>;
|
|
35
|
-
export declare function chatStreamingChoiceFromJSON(jsonString: string): SafeParseResult<ChatStreamingChoice, SDKValidationError>;
|
|
36
16
|
//# sourceMappingURL=chatresponsechoice.d.ts.map
|
|
@@ -4,19 +4,9 @@
|
|
|
4
4
|
import * as z from "zod/v4";
|
|
5
5
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
|
-
import * as openEnums from "../types/enums.js";
|
|
8
7
|
import { AssistantMessage$inboundSchema, } from "./assistantmessage.js";
|
|
8
|
+
import { ChatCompletionFinishReason$inboundSchema, } from "./chatcompletionfinishreason.js";
|
|
9
9
|
import { ChatMessageTokenLogprobs$inboundSchema, } from "./chatmessagetokenlogprobs.js";
|
|
10
|
-
import { ChatStreamingMessageChunk$inboundSchema, } from "./chatstreamingmessagechunk.js";
|
|
11
|
-
export const ChatCompletionFinishReason = {
|
|
12
|
-
ToolCalls: "tool_calls",
|
|
13
|
-
Stop: "stop",
|
|
14
|
-
Length: "length",
|
|
15
|
-
ContentFilter: "content_filter",
|
|
16
|
-
Error: "error",
|
|
17
|
-
};
|
|
18
|
-
/** @internal */
|
|
19
|
-
export const ChatCompletionFinishReason$inboundSchema = openEnums.inboundSchema(ChatCompletionFinishReason);
|
|
20
10
|
/** @internal */
|
|
21
11
|
export const ChatResponseChoice$inboundSchema = z.object({
|
|
22
12
|
finish_reason: z.nullable(ChatCompletionFinishReason$inboundSchema),
|
|
@@ -31,18 +21,4 @@ export const ChatResponseChoice$inboundSchema = z.object({
|
|
|
31
21
|
export function chatResponseChoiceFromJSON(jsonString) {
|
|
32
22
|
return safeParse(jsonString, (x) => ChatResponseChoice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatResponseChoice' from JSON`);
|
|
33
23
|
}
|
|
34
|
-
/** @internal */
|
|
35
|
-
export const ChatStreamingChoice$inboundSchema = z.object({
|
|
36
|
-
delta: ChatStreamingMessageChunk$inboundSchema,
|
|
37
|
-
finish_reason: z.nullable(ChatCompletionFinishReason$inboundSchema),
|
|
38
|
-
index: z.number(),
|
|
39
|
-
logprobs: z.nullable(ChatMessageTokenLogprobs$inboundSchema).optional(),
|
|
40
|
-
}).transform((v) => {
|
|
41
|
-
return remap$(v, {
|
|
42
|
-
"finish_reason": "finishReason",
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
export function chatStreamingChoiceFromJSON(jsonString) {
|
|
46
|
-
return safeParse(jsonString, (x) => ChatStreamingChoice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatStreamingChoice' from JSON`);
|
|
47
|
-
}
|
|
48
24
|
//# sourceMappingURL=chatresponsechoice.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { ChatCompletionFinishReason } from "./chatcompletionfinishreason.js";
|
|
4
|
+
import { ChatMessageTokenLogprobs } from "./chatmessagetokenlogprobs.js";
|
|
5
|
+
import { ChatStreamingMessageChunk } from "./chatstreamingmessagechunk.js";
|
|
6
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
7
|
+
export type ChatStreamingChoice = {
|
|
8
|
+
delta: ChatStreamingMessageChunk;
|
|
9
|
+
finishReason: ChatCompletionFinishReason | null;
|
|
10
|
+
index: number;
|
|
11
|
+
logprobs?: ChatMessageTokenLogprobs | null | undefined;
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare const ChatStreamingChoice$inboundSchema: z.ZodType<ChatStreamingChoice, unknown>;
|
|
15
|
+
export declare function chatStreamingChoiceFromJSON(jsonString: string): SafeParseResult<ChatStreamingChoice, SDKValidationError>;
|
|
16
|
+
//# sourceMappingURL=chatstreamingchoice.d.ts.map
|