@orq-ai/node 4.1.0-rc.45 → 4.1.0-rc.50
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/README.md +31 -24
- package/bin/mcp-server.js +3439 -531
- package/bin/mcp-server.js.map +65 -58
- package/examples/package-lock.json +1 -1
- package/funcs/routerChatCompletions.d.ts +23 -0
- package/funcs/routerChatCompletions.d.ts.map +1 -0
- package/funcs/routerChatCompletions.js +121 -0
- package/funcs/routerChatCompletions.js.map +1 -0
- package/funcs/routerImagesGenerate.d.ts +17 -0
- package/funcs/routerImagesGenerate.d.ts.map +1 -0
- package/funcs/routerImagesGenerate.js +114 -0
- package/funcs/routerImagesGenerate.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/lib/event-streams.js +1 -1
- package/lib/event-streams.js.map +1 -1
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.d.ts.map +1 -1
- package/mcp-server/server.js +5 -1
- package/mcp-server/server.js.map +1 -1
- package/mcp-server/tools/routerChatCompletions.d.ts +8 -0
- package/mcp-server/tools/routerChatCompletions.d.ts.map +1 -0
- package/mcp-server/tools/routerChatCompletions.js +64 -0
- package/mcp-server/tools/routerChatCompletions.js.map +1 -0
- package/mcp-server/tools/routerImagesGenerate.d.ts +8 -0
- package/mcp-server/tools/routerImagesGenerate.d.ts.map +1 -0
- package/mcp-server/tools/routerImagesGenerate.js +64 -0
- package/mcp-server/tools/routerImagesGenerate.js.map +1 -0
- package/models/components/conversationresponse.js +2 -2
- package/models/components/index.d.ts +1 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +1 -0
- package/models/components/index.js.map +1 -1
- package/models/components/partdoneevent.js +2 -2
- package/models/components/publiccontact.d.ts +52 -0
- package/models/components/publiccontact.d.ts.map +1 -0
- package/models/components/publiccontact.js +79 -0
- package/models/components/publiccontact.js.map +1 -0
- package/models/components/reasoningpart.js +2 -2
- package/models/operations/createagentrequest.d.ts +280 -36
- package/models/operations/createagentrequest.d.ts.map +1 -1
- package/models/operations/createagentrequest.js +308 -51
- package/models/operations/createagentrequest.js.map +1 -1
- package/models/operations/createagentresponserequest.d.ts.map +1 -1
- package/models/operations/createagentresponserequest.js +3 -1
- package/models/operations/createagentresponserequest.js.map +1 -1
- package/models/operations/createbudget.js +2 -2
- package/models/operations/createchatcompletion.d.ts +3152 -0
- package/models/operations/createchatcompletion.d.ts.map +1 -0
- package/models/operations/createchatcompletion.js +3398 -0
- package/models/operations/createchatcompletion.js.map +1 -0
- package/models/operations/createcontact.js +2 -2
- package/models/operations/createconversation.js +2 -2
- package/models/operations/createdataset.js +2 -2
- package/models/operations/createdatasetitem.js +8 -8
- package/models/operations/createdatasource.js +2 -2
- package/models/operations/createeval.js +28 -28
- package/models/operations/createimage.d.ts +433 -0
- package/models/operations/createimage.d.ts.map +1 -0
- package/models/operations/createimage.js +455 -0
- package/models/operations/createimage.js.map +1 -0
- package/models/operations/creatememory.d.ts +1 -1
- package/models/operations/createtool.js +12 -12
- package/models/operations/deploymentstream.d.ts.map +1 -1
- package/models/operations/deploymentstream.js +3 -1
- package/models/operations/deploymentstream.js.map +1 -1
- package/models/operations/fileget.js +2 -2
- package/models/operations/filelist.js +2 -2
- package/models/operations/fileupload.js +2 -2
- package/models/operations/generateconversationname.js +2 -2
- package/models/operations/getallprompts.d.ts +8 -8
- package/models/operations/getallprompts.d.ts.map +1 -1
- package/models/operations/getallprompts.js +11 -12
- package/models/operations/getallprompts.js.map +1 -1
- package/models/operations/getalltools.js +12 -12
- package/models/operations/getbudget.js +2 -2
- package/models/operations/getevals.js +28 -28
- package/models/operations/index.d.ts +2 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +2 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/invokeeval.d.ts +5 -5
- package/models/operations/invokeeval.d.ts.map +1 -1
- package/models/operations/invokeeval.js +7 -7
- package/models/operations/invokeeval.js.map +1 -1
- package/models/operations/listagents.d.ts +122 -0
- package/models/operations/listagents.d.ts.map +1 -1
- package/models/operations/listagents.js +129 -3
- package/models/operations/listagents.js.map +1 -1
- package/models/operations/listbudgets.js +2 -2
- package/models/operations/listcontacts.js +2 -2
- package/models/operations/listdatasetdatapoints.js +8 -8
- package/models/operations/listdatasets.js +2 -2
- package/models/operations/listdatasources.js +2 -2
- package/models/operations/retrieveagentrequest.d.ts +122 -0
- package/models/operations/retrieveagentrequest.d.ts.map +1 -1
- package/models/operations/retrieveagentrequest.js +128 -3
- package/models/operations/retrieveagentrequest.js.map +1 -1
- package/models/operations/retrievecontact.js +2 -2
- package/models/operations/retrieveconversation.js +2 -2
- package/models/operations/retrievedatapoint.js +8 -8
- package/models/operations/retrievedataset.js +2 -2
- package/models/operations/retrievedatasource.js +2 -2
- package/models/operations/retrievetool.js +12 -12
- package/models/operations/runagent.d.ts +122 -0
- package/models/operations/runagent.d.ts.map +1 -1
- package/models/operations/runagent.js +132 -7
- package/models/operations/runagent.js.map +1 -1
- package/models/operations/streamrunagent.d.ts +122 -0
- package/models/operations/streamrunagent.d.ts.map +1 -1
- package/models/operations/streamrunagent.js +131 -7
- package/models/operations/streamrunagent.js.map +1 -1
- package/models/operations/updateagent.d.ts +244 -0
- package/models/operations/updateagent.d.ts.map +1 -1
- package/models/operations/updateagent.js +255 -7
- package/models/operations/updateagent.js.map +1 -1
- package/models/operations/updatebudget.js +2 -2
- package/models/operations/updatecontact.js +2 -2
- package/models/operations/updateconversation.js +2 -2
- package/models/operations/updatedatapoint.js +8 -8
- package/models/operations/updatedataset.js +2 -2
- package/models/operations/updatedatasource.js +2 -2
- package/models/operations/updateeval.js +28 -28
- package/models/operations/updatememory.d.ts +1 -1
- package/models/operations/updatetool.js +14 -14
- package/package.json +1 -1
- package/sdk/router.d.ts +23 -0
- package/sdk/router.d.ts.map +1 -0
- package/sdk/router.js +34 -0
- package/sdk/router.js.map +1 -0
- package/sdk/sdk.d.ts +3 -0
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +4 -0
- package/sdk/sdk.js.map +1 -1
- package/src/funcs/routerChatCompletions.ts +172 -0
- package/src/funcs/routerImagesGenerate.ts +160 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/event-streams.ts +1 -1
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +5 -1
- package/src/mcp-server/tools/routerChatCompletions.ts +37 -0
- package/src/mcp-server/tools/routerImagesGenerate.ts +37 -0
- package/src/models/components/conversationresponse.ts +2 -2
- package/src/models/components/index.ts +1 -0
- package/src/models/components/partdoneevent.ts +2 -2
- package/src/models/components/publiccontact.ts +99 -0
- package/src/models/components/reasoningpart.ts +2 -2
- package/src/models/operations/createagentrequest.ts +760 -113
- package/src/models/operations/createagentresponserequest.ts +2 -1
- package/src/models/operations/createbudget.ts +2 -2
- package/src/models/operations/createchatcompletion.ts +8911 -0
- package/src/models/operations/createcontact.ts +2 -2
- package/src/models/operations/createconversation.ts +2 -2
- package/src/models/operations/createdataset.ts +2 -2
- package/src/models/operations/createdatasetitem.ts +8 -8
- package/src/models/operations/createdatasource.ts +2 -2
- package/src/models/operations/createeval.ts +28 -28
- package/src/models/operations/createimage.ts +966 -0
- package/src/models/operations/creatememory.ts +1 -1
- package/src/models/operations/createtool.ts +12 -12
- package/src/models/operations/deploymentstream.ts +2 -1
- package/src/models/operations/fileget.ts +2 -2
- package/src/models/operations/filelist.ts +2 -2
- package/src/models/operations/fileupload.ts +2 -2
- package/src/models/operations/generateconversationname.ts +2 -2
- package/src/models/operations/getallprompts.ts +45 -38
- package/src/models/operations/getalltools.ts +12 -12
- package/src/models/operations/getbudget.ts +2 -2
- package/src/models/operations/getevals.ts +28 -28
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/invokeeval.ts +11 -10
- package/src/models/operations/listagents.ts +313 -0
- package/src/models/operations/listbudgets.ts +2 -2
- package/src/models/operations/listcontacts.ts +2 -2
- package/src/models/operations/listdatasetdatapoints.ts +8 -8
- package/src/models/operations/listdatasets.ts +2 -2
- package/src/models/operations/listdatasources.ts +2 -2
- package/src/models/operations/retrieveagentrequest.ts +337 -0
- package/src/models/operations/retrievecontact.ts +2 -2
- package/src/models/operations/retrieveconversation.ts +2 -2
- package/src/models/operations/retrievedatapoint.ts +8 -8
- package/src/models/operations/retrievedataset.ts +2 -2
- package/src/models/operations/retrievedatasource.ts +2 -2
- package/src/models/operations/retrievetool.ts +12 -12
- package/src/models/operations/runagent.ts +315 -2
- package/src/models/operations/streamrunagent.ts +342 -2
- package/src/models/operations/updateagent.ts +659 -0
- package/src/models/operations/updatebudget.ts +2 -2
- package/src/models/operations/updatecontact.ts +2 -2
- package/src/models/operations/updateconversation.ts +2 -2
- package/src/models/operations/updatedatapoint.ts +8 -8
- package/src/models/operations/updatedataset.ts +2 -2
- package/src/models/operations/updatedatasource.ts +2 -2
- package/src/models/operations/updateeval.ts +28 -28
- package/src/models/operations/updatememory.ts +1 -1
- package/src/models/operations/updatetool.ts +14 -14
- package/src/sdk/router.ts +52 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,966 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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 * as components from "../components/index.js";
|
|
11
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Allows to set transparency for the background of the generated image(s). This parameter is only supported for `openai/gpt-image-1`.
|
|
15
|
+
*/
|
|
16
|
+
export const Background = {
|
|
17
|
+
Transparent: "transparent",
|
|
18
|
+
Opaque: "opaque",
|
|
19
|
+
Auto: "auto",
|
|
20
|
+
} as const;
|
|
21
|
+
/**
|
|
22
|
+
* Allows to set transparency for the background of the generated image(s). This parameter is only supported for `openai/gpt-image-1`.
|
|
23
|
+
*/
|
|
24
|
+
export type Background = ClosedEnum<typeof Background>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Control the content-moderation level for images generated by `gpt-image-1`. Must be either `low` or `auto`.
|
|
28
|
+
*/
|
|
29
|
+
export const Moderation = {
|
|
30
|
+
Low: "low",
|
|
31
|
+
Auto: "auto",
|
|
32
|
+
} as const;
|
|
33
|
+
/**
|
|
34
|
+
* Control the content-moderation level for images generated by `gpt-image-1`. Must be either `low` or `auto`.
|
|
35
|
+
*/
|
|
36
|
+
export type Moderation = ClosedEnum<typeof Moderation>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The format in which the generated images are returned. This parameter is only supported for `openai/gpt-image-1`.
|
|
40
|
+
*/
|
|
41
|
+
export const OutputFormat = {
|
|
42
|
+
Png: "png",
|
|
43
|
+
Jpeg: "jpeg",
|
|
44
|
+
Webp: "webp",
|
|
45
|
+
} as const;
|
|
46
|
+
/**
|
|
47
|
+
* The format in which the generated images are returned. This parameter is only supported for `openai/gpt-image-1`.
|
|
48
|
+
*/
|
|
49
|
+
export type OutputFormat = ClosedEnum<typeof OutputFormat>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The quality of the image that will be generated. `auto` will automatically select the best quality for the given model.
|
|
53
|
+
*/
|
|
54
|
+
export const Quality = {
|
|
55
|
+
Auto: "auto",
|
|
56
|
+
High: "high",
|
|
57
|
+
Medium: "medium",
|
|
58
|
+
Low: "low",
|
|
59
|
+
Hd: "hd",
|
|
60
|
+
Standard: "standard",
|
|
61
|
+
} as const;
|
|
62
|
+
/**
|
|
63
|
+
* The quality of the image that will be generated. `auto` will automatically select the best quality for the given model.
|
|
64
|
+
*/
|
|
65
|
+
export type Quality = ClosedEnum<typeof Quality>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The format in which generated images are returned. Must be one of `url` or `b64_json`. This parameter isn't supported for `gpt-image-1` which will always return base64-encoded images.
|
|
69
|
+
*/
|
|
70
|
+
export const CreateImageResponseFormat = {
|
|
71
|
+
Url: "url",
|
|
72
|
+
B64Json: "b64_json",
|
|
73
|
+
} as const;
|
|
74
|
+
/**
|
|
75
|
+
* The format in which generated images are returned. Must be one of `url` or `b64_json`. This parameter isn't supported for `gpt-image-1` which will always return base64-encoded images.
|
|
76
|
+
*/
|
|
77
|
+
export type CreateImageResponseFormat = ClosedEnum<
|
|
78
|
+
typeof CreateImageResponseFormat
|
|
79
|
+
>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The style of the generated images. This parameter is only supported for `openai/dall-e-3`. Must be one of `vivid` or `natural`.
|
|
83
|
+
*/
|
|
84
|
+
export const Style = {
|
|
85
|
+
Vivid: "vivid",
|
|
86
|
+
Natural: "natural",
|
|
87
|
+
} as const;
|
|
88
|
+
/**
|
|
89
|
+
* The style of the generated images. This parameter is only supported for `openai/dall-e-3`. Must be one of `vivid` or `natural`.
|
|
90
|
+
*/
|
|
91
|
+
export type Style = ClosedEnum<typeof Style>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Retry configuration for the request
|
|
95
|
+
*/
|
|
96
|
+
export type CreateImageRetry = {
|
|
97
|
+
/**
|
|
98
|
+
* Number of retry attempts (1-5)
|
|
99
|
+
*/
|
|
100
|
+
count?: number | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* HTTP status codes that trigger retry logic
|
|
103
|
+
*/
|
|
104
|
+
onCodes?: Array<number> | undefined;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export type CreateImageFallbacks = {
|
|
108
|
+
/**
|
|
109
|
+
* Fallback model identifier
|
|
110
|
+
*/
|
|
111
|
+
model: string;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const CreateImageType = {
|
|
115
|
+
ExactMatch: "exact_match",
|
|
116
|
+
} as const;
|
|
117
|
+
export type CreateImageType = ClosedEnum<typeof CreateImageType>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Cache configuration for the request.
|
|
121
|
+
*/
|
|
122
|
+
export type CreateImageCache = {
|
|
123
|
+
/**
|
|
124
|
+
* Time to live for cached responses in seconds. Maximum 259200 seconds (3 days).
|
|
125
|
+
*/
|
|
126
|
+
ttl?: number | undefined;
|
|
127
|
+
type: CreateImageType;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const CreateImageLoadBalancerType = {
|
|
131
|
+
WeightBased: "weight_based",
|
|
132
|
+
} as const;
|
|
133
|
+
export type CreateImageLoadBalancerType = ClosedEnum<
|
|
134
|
+
typeof CreateImageLoadBalancerType
|
|
135
|
+
>;
|
|
136
|
+
|
|
137
|
+
export type CreateImageLoadBalancer1 = {
|
|
138
|
+
type: CreateImageLoadBalancerType;
|
|
139
|
+
/**
|
|
140
|
+
* Model identifier for load balancing
|
|
141
|
+
*/
|
|
142
|
+
model: string;
|
|
143
|
+
/**
|
|
144
|
+
* Weight assigned to this model for load balancing
|
|
145
|
+
*/
|
|
146
|
+
weight?: number | undefined;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export type CreateImageLoadBalancer = CreateImageLoadBalancer1;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured.
|
|
153
|
+
*/
|
|
154
|
+
export type CreateImageTimeout = {
|
|
155
|
+
/**
|
|
156
|
+
* Timeout value in milliseconds
|
|
157
|
+
*/
|
|
158
|
+
callTimeout: number;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export type CreateImageOrq = {
|
|
162
|
+
/**
|
|
163
|
+
* The name to display on the trace. If not specified, the default system name will be used.
|
|
164
|
+
*/
|
|
165
|
+
name?: string | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* Retry configuration for the request
|
|
168
|
+
*/
|
|
169
|
+
retry?: CreateImageRetry | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* Array of fallback models to use if primary model fails
|
|
172
|
+
*/
|
|
173
|
+
fallbacks?: Array<CreateImageFallbacks> | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Information about the contact making the request. If the contact does not exist, it will be created automatically.
|
|
176
|
+
*/
|
|
177
|
+
contact?: components.PublicContact | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* Cache configuration for the request.
|
|
180
|
+
*/
|
|
181
|
+
cache?: CreateImageCache | undefined;
|
|
182
|
+
/**
|
|
183
|
+
* Array of models with weights for load balancing requests
|
|
184
|
+
*/
|
|
185
|
+
loadBalancer?: Array<CreateImageLoadBalancer1> | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured.
|
|
188
|
+
*/
|
|
189
|
+
timeout?: CreateImageTimeout | undefined;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* input
|
|
194
|
+
*/
|
|
195
|
+
export type CreateImageRequestBody = {
|
|
196
|
+
/**
|
|
197
|
+
* A text description of the desired image(s).
|
|
198
|
+
*/
|
|
199
|
+
prompt: string;
|
|
200
|
+
/**
|
|
201
|
+
* Allows to set transparency for the background of the generated image(s). This parameter is only supported for `openai/gpt-image-1`.
|
|
202
|
+
*/
|
|
203
|
+
background?: Background | null | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* The model to use for image generation. One of `openai/dall-e-2`, `openai/dall-e-3`, or `openai/gpt-image-1`.
|
|
206
|
+
*/
|
|
207
|
+
model: string;
|
|
208
|
+
/**
|
|
209
|
+
* Control the content-moderation level for images generated by `gpt-image-1`. Must be either `low` or `auto`.
|
|
210
|
+
*/
|
|
211
|
+
moderation?: Moderation | null | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported.
|
|
214
|
+
*/
|
|
215
|
+
n?: number | null | undefined;
|
|
216
|
+
/**
|
|
217
|
+
* The compression level (0-100%) for the generated images. This parameter is only supported for `gpt-image-1` with the `webp` or `jpeg` output formats.
|
|
218
|
+
*/
|
|
219
|
+
outputCompression?: number | null | undefined;
|
|
220
|
+
/**
|
|
221
|
+
* The format in which the generated images are returned. This parameter is only supported for `openai/gpt-image-1`.
|
|
222
|
+
*/
|
|
223
|
+
outputFormat?: OutputFormat | null | undefined;
|
|
224
|
+
/**
|
|
225
|
+
* The quality of the image that will be generated. `auto` will automatically select the best quality for the given model.
|
|
226
|
+
*/
|
|
227
|
+
quality?: Quality | null | undefined;
|
|
228
|
+
/**
|
|
229
|
+
* The format in which generated images are returned. Must be one of `url` or `b64_json`. This parameter isn't supported for `gpt-image-1` which will always return base64-encoded images.
|
|
230
|
+
*/
|
|
231
|
+
responseFormat?: CreateImageResponseFormat | null | undefined;
|
|
232
|
+
/**
|
|
233
|
+
* The size of the generated images. Must be one of the specified sizes for each model.
|
|
234
|
+
*/
|
|
235
|
+
size?: string | null | undefined;
|
|
236
|
+
/**
|
|
237
|
+
* The style of the generated images. This parameter is only supported for `openai/dall-e-3`. Must be one of `vivid` or `natural`.
|
|
238
|
+
*/
|
|
239
|
+
style?: Style | null | undefined;
|
|
240
|
+
orq?: CreateImageOrq | undefined;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export type CreateImageData = {
|
|
244
|
+
/**
|
|
245
|
+
* The prompt that was used to generate the image, if there was any revision to the prompt.
|
|
246
|
+
*/
|
|
247
|
+
revisedPrompt?: string | null | undefined;
|
|
248
|
+
/**
|
|
249
|
+
* The base64-encoded JSON of the generated image, if `response_format` is `b64_json`
|
|
250
|
+
*/
|
|
251
|
+
b64Json?: string | undefined;
|
|
252
|
+
/**
|
|
253
|
+
* The url of the generated image, if `response_format` is `url` (default)
|
|
254
|
+
*/
|
|
255
|
+
url?: string | undefined;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
export type InputTokensDetails = {
|
|
259
|
+
imageTokens?: number | undefined;
|
|
260
|
+
textTokens?: number | undefined;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export type CreateImageUsage = {
|
|
264
|
+
inputTokens?: number | undefined;
|
|
265
|
+
inputTokensDetails: InputTokensDetails;
|
|
266
|
+
outputTokens?: number | undefined;
|
|
267
|
+
totalTokens?: number | undefined;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Represents an image generation response from the API.
|
|
272
|
+
*/
|
|
273
|
+
export type CreateImageResponseBody = {
|
|
274
|
+
/**
|
|
275
|
+
* The Unix timestamp (in seconds) of when the image was created.
|
|
276
|
+
*/
|
|
277
|
+
created: number;
|
|
278
|
+
/**
|
|
279
|
+
* Represents the url or the content of an image generated.
|
|
280
|
+
*/
|
|
281
|
+
data: Array<CreateImageData>;
|
|
282
|
+
usage?: CreateImageUsage | undefined;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
/** @internal */
|
|
286
|
+
export const Background$inboundSchema: z.ZodNativeEnum<typeof Background> = z
|
|
287
|
+
.nativeEnum(Background);
|
|
288
|
+
/** @internal */
|
|
289
|
+
export const Background$outboundSchema: z.ZodNativeEnum<typeof Background> =
|
|
290
|
+
Background$inboundSchema;
|
|
291
|
+
|
|
292
|
+
/** @internal */
|
|
293
|
+
export const Moderation$inboundSchema: z.ZodNativeEnum<typeof Moderation> = z
|
|
294
|
+
.nativeEnum(Moderation);
|
|
295
|
+
/** @internal */
|
|
296
|
+
export const Moderation$outboundSchema: z.ZodNativeEnum<typeof Moderation> =
|
|
297
|
+
Moderation$inboundSchema;
|
|
298
|
+
|
|
299
|
+
/** @internal */
|
|
300
|
+
export const OutputFormat$inboundSchema: z.ZodNativeEnum<typeof OutputFormat> =
|
|
301
|
+
z.nativeEnum(OutputFormat);
|
|
302
|
+
/** @internal */
|
|
303
|
+
export const OutputFormat$outboundSchema: z.ZodNativeEnum<typeof OutputFormat> =
|
|
304
|
+
OutputFormat$inboundSchema;
|
|
305
|
+
|
|
306
|
+
/** @internal */
|
|
307
|
+
export const Quality$inboundSchema: z.ZodNativeEnum<typeof Quality> = z
|
|
308
|
+
.nativeEnum(Quality);
|
|
309
|
+
/** @internal */
|
|
310
|
+
export const Quality$outboundSchema: z.ZodNativeEnum<typeof Quality> =
|
|
311
|
+
Quality$inboundSchema;
|
|
312
|
+
|
|
313
|
+
/** @internal */
|
|
314
|
+
export const CreateImageResponseFormat$inboundSchema: z.ZodNativeEnum<
|
|
315
|
+
typeof CreateImageResponseFormat
|
|
316
|
+
> = z.nativeEnum(CreateImageResponseFormat);
|
|
317
|
+
/** @internal */
|
|
318
|
+
export const CreateImageResponseFormat$outboundSchema: z.ZodNativeEnum<
|
|
319
|
+
typeof CreateImageResponseFormat
|
|
320
|
+
> = CreateImageResponseFormat$inboundSchema;
|
|
321
|
+
|
|
322
|
+
/** @internal */
|
|
323
|
+
export const Style$inboundSchema: z.ZodNativeEnum<typeof Style> = z.nativeEnum(
|
|
324
|
+
Style,
|
|
325
|
+
);
|
|
326
|
+
/** @internal */
|
|
327
|
+
export const Style$outboundSchema: z.ZodNativeEnum<typeof Style> =
|
|
328
|
+
Style$inboundSchema;
|
|
329
|
+
|
|
330
|
+
/** @internal */
|
|
331
|
+
export const CreateImageRetry$inboundSchema: z.ZodType<
|
|
332
|
+
CreateImageRetry,
|
|
333
|
+
z.ZodTypeDef,
|
|
334
|
+
unknown
|
|
335
|
+
> = z.object({
|
|
336
|
+
count: z.number().default(3),
|
|
337
|
+
on_codes: z.array(z.number()).optional(),
|
|
338
|
+
}).transform((v) => {
|
|
339
|
+
return remap$(v, {
|
|
340
|
+
"on_codes": "onCodes",
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
/** @internal */
|
|
344
|
+
export type CreateImageRetry$Outbound = {
|
|
345
|
+
count: number;
|
|
346
|
+
on_codes?: Array<number> | undefined;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
/** @internal */
|
|
350
|
+
export const CreateImageRetry$outboundSchema: z.ZodType<
|
|
351
|
+
CreateImageRetry$Outbound,
|
|
352
|
+
z.ZodTypeDef,
|
|
353
|
+
CreateImageRetry
|
|
354
|
+
> = z.object({
|
|
355
|
+
count: z.number().default(3),
|
|
356
|
+
onCodes: z.array(z.number()).optional(),
|
|
357
|
+
}).transform((v) => {
|
|
358
|
+
return remap$(v, {
|
|
359
|
+
onCodes: "on_codes",
|
|
360
|
+
});
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
export function createImageRetryToJSON(
|
|
364
|
+
createImageRetry: CreateImageRetry,
|
|
365
|
+
): string {
|
|
366
|
+
return JSON.stringify(
|
|
367
|
+
CreateImageRetry$outboundSchema.parse(createImageRetry),
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
export function createImageRetryFromJSON(
|
|
371
|
+
jsonString: string,
|
|
372
|
+
): SafeParseResult<CreateImageRetry, SDKValidationError> {
|
|
373
|
+
return safeParse(
|
|
374
|
+
jsonString,
|
|
375
|
+
(x) => CreateImageRetry$inboundSchema.parse(JSON.parse(x)),
|
|
376
|
+
`Failed to parse 'CreateImageRetry' from JSON`,
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/** @internal */
|
|
381
|
+
export const CreateImageFallbacks$inboundSchema: z.ZodType<
|
|
382
|
+
CreateImageFallbacks,
|
|
383
|
+
z.ZodTypeDef,
|
|
384
|
+
unknown
|
|
385
|
+
> = z.object({
|
|
386
|
+
model: z.string(),
|
|
387
|
+
});
|
|
388
|
+
/** @internal */
|
|
389
|
+
export type CreateImageFallbacks$Outbound = {
|
|
390
|
+
model: string;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
/** @internal */
|
|
394
|
+
export const CreateImageFallbacks$outboundSchema: z.ZodType<
|
|
395
|
+
CreateImageFallbacks$Outbound,
|
|
396
|
+
z.ZodTypeDef,
|
|
397
|
+
CreateImageFallbacks
|
|
398
|
+
> = z.object({
|
|
399
|
+
model: z.string(),
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
export function createImageFallbacksToJSON(
|
|
403
|
+
createImageFallbacks: CreateImageFallbacks,
|
|
404
|
+
): string {
|
|
405
|
+
return JSON.stringify(
|
|
406
|
+
CreateImageFallbacks$outboundSchema.parse(createImageFallbacks),
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
export function createImageFallbacksFromJSON(
|
|
410
|
+
jsonString: string,
|
|
411
|
+
): SafeParseResult<CreateImageFallbacks, SDKValidationError> {
|
|
412
|
+
return safeParse(
|
|
413
|
+
jsonString,
|
|
414
|
+
(x) => CreateImageFallbacks$inboundSchema.parse(JSON.parse(x)),
|
|
415
|
+
`Failed to parse 'CreateImageFallbacks' from JSON`,
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/** @internal */
|
|
420
|
+
export const CreateImageType$inboundSchema: z.ZodNativeEnum<
|
|
421
|
+
typeof CreateImageType
|
|
422
|
+
> = z.nativeEnum(CreateImageType);
|
|
423
|
+
/** @internal */
|
|
424
|
+
export const CreateImageType$outboundSchema: z.ZodNativeEnum<
|
|
425
|
+
typeof CreateImageType
|
|
426
|
+
> = CreateImageType$inboundSchema;
|
|
427
|
+
|
|
428
|
+
/** @internal */
|
|
429
|
+
export const CreateImageCache$inboundSchema: z.ZodType<
|
|
430
|
+
CreateImageCache,
|
|
431
|
+
z.ZodTypeDef,
|
|
432
|
+
unknown
|
|
433
|
+
> = z.object({
|
|
434
|
+
ttl: z.number().default(1800),
|
|
435
|
+
type: CreateImageType$inboundSchema,
|
|
436
|
+
});
|
|
437
|
+
/** @internal */
|
|
438
|
+
export type CreateImageCache$Outbound = {
|
|
439
|
+
ttl: number;
|
|
440
|
+
type: string;
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
/** @internal */
|
|
444
|
+
export const CreateImageCache$outboundSchema: z.ZodType<
|
|
445
|
+
CreateImageCache$Outbound,
|
|
446
|
+
z.ZodTypeDef,
|
|
447
|
+
CreateImageCache
|
|
448
|
+
> = z.object({
|
|
449
|
+
ttl: z.number().default(1800),
|
|
450
|
+
type: CreateImageType$outboundSchema,
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
export function createImageCacheToJSON(
|
|
454
|
+
createImageCache: CreateImageCache,
|
|
455
|
+
): string {
|
|
456
|
+
return JSON.stringify(
|
|
457
|
+
CreateImageCache$outboundSchema.parse(createImageCache),
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
export function createImageCacheFromJSON(
|
|
461
|
+
jsonString: string,
|
|
462
|
+
): SafeParseResult<CreateImageCache, SDKValidationError> {
|
|
463
|
+
return safeParse(
|
|
464
|
+
jsonString,
|
|
465
|
+
(x) => CreateImageCache$inboundSchema.parse(JSON.parse(x)),
|
|
466
|
+
`Failed to parse 'CreateImageCache' from JSON`,
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/** @internal */
|
|
471
|
+
export const CreateImageLoadBalancerType$inboundSchema: z.ZodNativeEnum<
|
|
472
|
+
typeof CreateImageLoadBalancerType
|
|
473
|
+
> = z.nativeEnum(CreateImageLoadBalancerType);
|
|
474
|
+
/** @internal */
|
|
475
|
+
export const CreateImageLoadBalancerType$outboundSchema: z.ZodNativeEnum<
|
|
476
|
+
typeof CreateImageLoadBalancerType
|
|
477
|
+
> = CreateImageLoadBalancerType$inboundSchema;
|
|
478
|
+
|
|
479
|
+
/** @internal */
|
|
480
|
+
export const CreateImageLoadBalancer1$inboundSchema: z.ZodType<
|
|
481
|
+
CreateImageLoadBalancer1,
|
|
482
|
+
z.ZodTypeDef,
|
|
483
|
+
unknown
|
|
484
|
+
> = z.object({
|
|
485
|
+
type: CreateImageLoadBalancerType$inboundSchema,
|
|
486
|
+
model: z.string(),
|
|
487
|
+
weight: z.number().default(0.5),
|
|
488
|
+
});
|
|
489
|
+
/** @internal */
|
|
490
|
+
export type CreateImageLoadBalancer1$Outbound = {
|
|
491
|
+
type: string;
|
|
492
|
+
model: string;
|
|
493
|
+
weight: number;
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
/** @internal */
|
|
497
|
+
export const CreateImageLoadBalancer1$outboundSchema: z.ZodType<
|
|
498
|
+
CreateImageLoadBalancer1$Outbound,
|
|
499
|
+
z.ZodTypeDef,
|
|
500
|
+
CreateImageLoadBalancer1
|
|
501
|
+
> = z.object({
|
|
502
|
+
type: CreateImageLoadBalancerType$outboundSchema,
|
|
503
|
+
model: z.string(),
|
|
504
|
+
weight: z.number().default(0.5),
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
export function createImageLoadBalancer1ToJSON(
|
|
508
|
+
createImageLoadBalancer1: CreateImageLoadBalancer1,
|
|
509
|
+
): string {
|
|
510
|
+
return JSON.stringify(
|
|
511
|
+
CreateImageLoadBalancer1$outboundSchema.parse(createImageLoadBalancer1),
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
export function createImageLoadBalancer1FromJSON(
|
|
515
|
+
jsonString: string,
|
|
516
|
+
): SafeParseResult<CreateImageLoadBalancer1, SDKValidationError> {
|
|
517
|
+
return safeParse(
|
|
518
|
+
jsonString,
|
|
519
|
+
(x) => CreateImageLoadBalancer1$inboundSchema.parse(JSON.parse(x)),
|
|
520
|
+
`Failed to parse 'CreateImageLoadBalancer1' from JSON`,
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/** @internal */
|
|
525
|
+
export const CreateImageLoadBalancer$inboundSchema: z.ZodType<
|
|
526
|
+
CreateImageLoadBalancer,
|
|
527
|
+
z.ZodTypeDef,
|
|
528
|
+
unknown
|
|
529
|
+
> = z.lazy(() => CreateImageLoadBalancer1$inboundSchema);
|
|
530
|
+
/** @internal */
|
|
531
|
+
export type CreateImageLoadBalancer$Outbound =
|
|
532
|
+
CreateImageLoadBalancer1$Outbound;
|
|
533
|
+
|
|
534
|
+
/** @internal */
|
|
535
|
+
export const CreateImageLoadBalancer$outboundSchema: z.ZodType<
|
|
536
|
+
CreateImageLoadBalancer$Outbound,
|
|
537
|
+
z.ZodTypeDef,
|
|
538
|
+
CreateImageLoadBalancer
|
|
539
|
+
> = z.lazy(() => CreateImageLoadBalancer1$outboundSchema);
|
|
540
|
+
|
|
541
|
+
export function createImageLoadBalancerToJSON(
|
|
542
|
+
createImageLoadBalancer: CreateImageLoadBalancer,
|
|
543
|
+
): string {
|
|
544
|
+
return JSON.stringify(
|
|
545
|
+
CreateImageLoadBalancer$outboundSchema.parse(createImageLoadBalancer),
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
export function createImageLoadBalancerFromJSON(
|
|
549
|
+
jsonString: string,
|
|
550
|
+
): SafeParseResult<CreateImageLoadBalancer, SDKValidationError> {
|
|
551
|
+
return safeParse(
|
|
552
|
+
jsonString,
|
|
553
|
+
(x) => CreateImageLoadBalancer$inboundSchema.parse(JSON.parse(x)),
|
|
554
|
+
`Failed to parse 'CreateImageLoadBalancer' from JSON`,
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/** @internal */
|
|
559
|
+
export const CreateImageTimeout$inboundSchema: z.ZodType<
|
|
560
|
+
CreateImageTimeout,
|
|
561
|
+
z.ZodTypeDef,
|
|
562
|
+
unknown
|
|
563
|
+
> = z.object({
|
|
564
|
+
call_timeout: z.number(),
|
|
565
|
+
}).transform((v) => {
|
|
566
|
+
return remap$(v, {
|
|
567
|
+
"call_timeout": "callTimeout",
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
/** @internal */
|
|
571
|
+
export type CreateImageTimeout$Outbound = {
|
|
572
|
+
call_timeout: number;
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
/** @internal */
|
|
576
|
+
export const CreateImageTimeout$outboundSchema: z.ZodType<
|
|
577
|
+
CreateImageTimeout$Outbound,
|
|
578
|
+
z.ZodTypeDef,
|
|
579
|
+
CreateImageTimeout
|
|
580
|
+
> = z.object({
|
|
581
|
+
callTimeout: z.number(),
|
|
582
|
+
}).transform((v) => {
|
|
583
|
+
return remap$(v, {
|
|
584
|
+
callTimeout: "call_timeout",
|
|
585
|
+
});
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
export function createImageTimeoutToJSON(
|
|
589
|
+
createImageTimeout: CreateImageTimeout,
|
|
590
|
+
): string {
|
|
591
|
+
return JSON.stringify(
|
|
592
|
+
CreateImageTimeout$outboundSchema.parse(createImageTimeout),
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
export function createImageTimeoutFromJSON(
|
|
596
|
+
jsonString: string,
|
|
597
|
+
): SafeParseResult<CreateImageTimeout, SDKValidationError> {
|
|
598
|
+
return safeParse(
|
|
599
|
+
jsonString,
|
|
600
|
+
(x) => CreateImageTimeout$inboundSchema.parse(JSON.parse(x)),
|
|
601
|
+
`Failed to parse 'CreateImageTimeout' from JSON`,
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/** @internal */
|
|
606
|
+
export const CreateImageOrq$inboundSchema: z.ZodType<
|
|
607
|
+
CreateImageOrq,
|
|
608
|
+
z.ZodTypeDef,
|
|
609
|
+
unknown
|
|
610
|
+
> = z.object({
|
|
611
|
+
name: z.string().optional(),
|
|
612
|
+
retry: z.lazy(() => CreateImageRetry$inboundSchema).optional(),
|
|
613
|
+
fallbacks: z.array(z.lazy(() => CreateImageFallbacks$inboundSchema))
|
|
614
|
+
.optional(),
|
|
615
|
+
contact: components.PublicContact$inboundSchema.optional(),
|
|
616
|
+
cache: z.lazy(() => CreateImageCache$inboundSchema).optional(),
|
|
617
|
+
load_balancer: z.array(z.lazy(() => CreateImageLoadBalancer1$inboundSchema))
|
|
618
|
+
.optional(),
|
|
619
|
+
timeout: z.lazy(() => CreateImageTimeout$inboundSchema).optional(),
|
|
620
|
+
}).transform((v) => {
|
|
621
|
+
return remap$(v, {
|
|
622
|
+
"load_balancer": "loadBalancer",
|
|
623
|
+
});
|
|
624
|
+
});
|
|
625
|
+
/** @internal */
|
|
626
|
+
export type CreateImageOrq$Outbound = {
|
|
627
|
+
name?: string | undefined;
|
|
628
|
+
retry?: CreateImageRetry$Outbound | undefined;
|
|
629
|
+
fallbacks?: Array<CreateImageFallbacks$Outbound> | undefined;
|
|
630
|
+
contact?: components.PublicContact$Outbound | undefined;
|
|
631
|
+
cache?: CreateImageCache$Outbound | undefined;
|
|
632
|
+
load_balancer?: Array<CreateImageLoadBalancer1$Outbound> | undefined;
|
|
633
|
+
timeout?: CreateImageTimeout$Outbound | undefined;
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
/** @internal */
|
|
637
|
+
export const CreateImageOrq$outboundSchema: z.ZodType<
|
|
638
|
+
CreateImageOrq$Outbound,
|
|
639
|
+
z.ZodTypeDef,
|
|
640
|
+
CreateImageOrq
|
|
641
|
+
> = z.object({
|
|
642
|
+
name: z.string().optional(),
|
|
643
|
+
retry: z.lazy(() => CreateImageRetry$outboundSchema).optional(),
|
|
644
|
+
fallbacks: z.array(z.lazy(() => CreateImageFallbacks$outboundSchema))
|
|
645
|
+
.optional(),
|
|
646
|
+
contact: components.PublicContact$outboundSchema.optional(),
|
|
647
|
+
cache: z.lazy(() => CreateImageCache$outboundSchema).optional(),
|
|
648
|
+
loadBalancer: z.array(z.lazy(() => CreateImageLoadBalancer1$outboundSchema))
|
|
649
|
+
.optional(),
|
|
650
|
+
timeout: z.lazy(() => CreateImageTimeout$outboundSchema).optional(),
|
|
651
|
+
}).transform((v) => {
|
|
652
|
+
return remap$(v, {
|
|
653
|
+
loadBalancer: "load_balancer",
|
|
654
|
+
});
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
export function createImageOrqToJSON(createImageOrq: CreateImageOrq): string {
|
|
658
|
+
return JSON.stringify(CreateImageOrq$outboundSchema.parse(createImageOrq));
|
|
659
|
+
}
|
|
660
|
+
export function createImageOrqFromJSON(
|
|
661
|
+
jsonString: string,
|
|
662
|
+
): SafeParseResult<CreateImageOrq, SDKValidationError> {
|
|
663
|
+
return safeParse(
|
|
664
|
+
jsonString,
|
|
665
|
+
(x) => CreateImageOrq$inboundSchema.parse(JSON.parse(x)),
|
|
666
|
+
`Failed to parse 'CreateImageOrq' from JSON`,
|
|
667
|
+
);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/** @internal */
|
|
671
|
+
export const CreateImageRequestBody$inboundSchema: z.ZodType<
|
|
672
|
+
CreateImageRequestBody,
|
|
673
|
+
z.ZodTypeDef,
|
|
674
|
+
unknown
|
|
675
|
+
> = z.object({
|
|
676
|
+
prompt: z.string(),
|
|
677
|
+
background: z.nullable(Background$inboundSchema).optional(),
|
|
678
|
+
model: z.string(),
|
|
679
|
+
moderation: z.nullable(Moderation$inboundSchema).optional(),
|
|
680
|
+
n: z.nullable(z.number().int().default(1)),
|
|
681
|
+
output_compression: z.nullable(z.number().int()).optional(),
|
|
682
|
+
output_format: z.nullable(OutputFormat$inboundSchema).optional(),
|
|
683
|
+
quality: z.nullable(Quality$inboundSchema).optional(),
|
|
684
|
+
response_format: z.nullable(CreateImageResponseFormat$inboundSchema)
|
|
685
|
+
.optional(),
|
|
686
|
+
size: z.nullable(z.string()).optional(),
|
|
687
|
+
style: z.nullable(Style$inboundSchema).optional(),
|
|
688
|
+
orq: z.lazy(() => CreateImageOrq$inboundSchema).optional(),
|
|
689
|
+
}).transform((v) => {
|
|
690
|
+
return remap$(v, {
|
|
691
|
+
"output_compression": "outputCompression",
|
|
692
|
+
"output_format": "outputFormat",
|
|
693
|
+
"response_format": "responseFormat",
|
|
694
|
+
});
|
|
695
|
+
});
|
|
696
|
+
/** @internal */
|
|
697
|
+
export type CreateImageRequestBody$Outbound = {
|
|
698
|
+
prompt: string;
|
|
699
|
+
background?: string | null | undefined;
|
|
700
|
+
model: string;
|
|
701
|
+
moderation?: string | null | undefined;
|
|
702
|
+
n: number | null;
|
|
703
|
+
output_compression?: number | null | undefined;
|
|
704
|
+
output_format?: string | null | undefined;
|
|
705
|
+
quality?: string | null | undefined;
|
|
706
|
+
response_format?: string | null | undefined;
|
|
707
|
+
size?: string | null | undefined;
|
|
708
|
+
style?: string | null | undefined;
|
|
709
|
+
orq?: CreateImageOrq$Outbound | undefined;
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
/** @internal */
|
|
713
|
+
export const CreateImageRequestBody$outboundSchema: z.ZodType<
|
|
714
|
+
CreateImageRequestBody$Outbound,
|
|
715
|
+
z.ZodTypeDef,
|
|
716
|
+
CreateImageRequestBody
|
|
717
|
+
> = z.object({
|
|
718
|
+
prompt: z.string(),
|
|
719
|
+
background: z.nullable(Background$outboundSchema).optional(),
|
|
720
|
+
model: z.string(),
|
|
721
|
+
moderation: z.nullable(Moderation$outboundSchema).optional(),
|
|
722
|
+
n: z.nullable(z.number().int().default(1)),
|
|
723
|
+
outputCompression: z.nullable(z.number().int()).optional(),
|
|
724
|
+
outputFormat: z.nullable(OutputFormat$outboundSchema).optional(),
|
|
725
|
+
quality: z.nullable(Quality$outboundSchema).optional(),
|
|
726
|
+
responseFormat: z.nullable(CreateImageResponseFormat$outboundSchema)
|
|
727
|
+
.optional(),
|
|
728
|
+
size: z.nullable(z.string()).optional(),
|
|
729
|
+
style: z.nullable(Style$outboundSchema).optional(),
|
|
730
|
+
orq: z.lazy(() => CreateImageOrq$outboundSchema).optional(),
|
|
731
|
+
}).transform((v) => {
|
|
732
|
+
return remap$(v, {
|
|
733
|
+
outputCompression: "output_compression",
|
|
734
|
+
outputFormat: "output_format",
|
|
735
|
+
responseFormat: "response_format",
|
|
736
|
+
});
|
|
737
|
+
});
|
|
738
|
+
|
|
739
|
+
export function createImageRequestBodyToJSON(
|
|
740
|
+
createImageRequestBody: CreateImageRequestBody,
|
|
741
|
+
): string {
|
|
742
|
+
return JSON.stringify(
|
|
743
|
+
CreateImageRequestBody$outboundSchema.parse(createImageRequestBody),
|
|
744
|
+
);
|
|
745
|
+
}
|
|
746
|
+
export function createImageRequestBodyFromJSON(
|
|
747
|
+
jsonString: string,
|
|
748
|
+
): SafeParseResult<CreateImageRequestBody, SDKValidationError> {
|
|
749
|
+
return safeParse(
|
|
750
|
+
jsonString,
|
|
751
|
+
(x) => CreateImageRequestBody$inboundSchema.parse(JSON.parse(x)),
|
|
752
|
+
`Failed to parse 'CreateImageRequestBody' from JSON`,
|
|
753
|
+
);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/** @internal */
|
|
757
|
+
export const CreateImageData$inboundSchema: z.ZodType<
|
|
758
|
+
CreateImageData,
|
|
759
|
+
z.ZodTypeDef,
|
|
760
|
+
unknown
|
|
761
|
+
> = z.object({
|
|
762
|
+
revised_prompt: z.nullable(z.string()).optional(),
|
|
763
|
+
b64_json: z.string().optional(),
|
|
764
|
+
url: z.string().optional(),
|
|
765
|
+
}).transform((v) => {
|
|
766
|
+
return remap$(v, {
|
|
767
|
+
"revised_prompt": "revisedPrompt",
|
|
768
|
+
"b64_json": "b64Json",
|
|
769
|
+
});
|
|
770
|
+
});
|
|
771
|
+
/** @internal */
|
|
772
|
+
export type CreateImageData$Outbound = {
|
|
773
|
+
revised_prompt?: string | null | undefined;
|
|
774
|
+
b64_json?: string | undefined;
|
|
775
|
+
url?: string | undefined;
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
/** @internal */
|
|
779
|
+
export const CreateImageData$outboundSchema: z.ZodType<
|
|
780
|
+
CreateImageData$Outbound,
|
|
781
|
+
z.ZodTypeDef,
|
|
782
|
+
CreateImageData
|
|
783
|
+
> = z.object({
|
|
784
|
+
revisedPrompt: z.nullable(z.string()).optional(),
|
|
785
|
+
b64Json: z.string().optional(),
|
|
786
|
+
url: z.string().optional(),
|
|
787
|
+
}).transform((v) => {
|
|
788
|
+
return remap$(v, {
|
|
789
|
+
revisedPrompt: "revised_prompt",
|
|
790
|
+
b64Json: "b64_json",
|
|
791
|
+
});
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
export function createImageDataToJSON(
|
|
795
|
+
createImageData: CreateImageData,
|
|
796
|
+
): string {
|
|
797
|
+
return JSON.stringify(CreateImageData$outboundSchema.parse(createImageData));
|
|
798
|
+
}
|
|
799
|
+
export function createImageDataFromJSON(
|
|
800
|
+
jsonString: string,
|
|
801
|
+
): SafeParseResult<CreateImageData, SDKValidationError> {
|
|
802
|
+
return safeParse(
|
|
803
|
+
jsonString,
|
|
804
|
+
(x) => CreateImageData$inboundSchema.parse(JSON.parse(x)),
|
|
805
|
+
`Failed to parse 'CreateImageData' from JSON`,
|
|
806
|
+
);
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/** @internal */
|
|
810
|
+
export const InputTokensDetails$inboundSchema: z.ZodType<
|
|
811
|
+
InputTokensDetails,
|
|
812
|
+
z.ZodTypeDef,
|
|
813
|
+
unknown
|
|
814
|
+
> = z.object({
|
|
815
|
+
image_tokens: z.number().optional(),
|
|
816
|
+
text_tokens: z.number().optional(),
|
|
817
|
+
}).transform((v) => {
|
|
818
|
+
return remap$(v, {
|
|
819
|
+
"image_tokens": "imageTokens",
|
|
820
|
+
"text_tokens": "textTokens",
|
|
821
|
+
});
|
|
822
|
+
});
|
|
823
|
+
/** @internal */
|
|
824
|
+
export type InputTokensDetails$Outbound = {
|
|
825
|
+
image_tokens?: number | undefined;
|
|
826
|
+
text_tokens?: number | undefined;
|
|
827
|
+
};
|
|
828
|
+
|
|
829
|
+
/** @internal */
|
|
830
|
+
export const InputTokensDetails$outboundSchema: z.ZodType<
|
|
831
|
+
InputTokensDetails$Outbound,
|
|
832
|
+
z.ZodTypeDef,
|
|
833
|
+
InputTokensDetails
|
|
834
|
+
> = z.object({
|
|
835
|
+
imageTokens: z.number().optional(),
|
|
836
|
+
textTokens: z.number().optional(),
|
|
837
|
+
}).transform((v) => {
|
|
838
|
+
return remap$(v, {
|
|
839
|
+
imageTokens: "image_tokens",
|
|
840
|
+
textTokens: "text_tokens",
|
|
841
|
+
});
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
export function inputTokensDetailsToJSON(
|
|
845
|
+
inputTokensDetails: InputTokensDetails,
|
|
846
|
+
): string {
|
|
847
|
+
return JSON.stringify(
|
|
848
|
+
InputTokensDetails$outboundSchema.parse(inputTokensDetails),
|
|
849
|
+
);
|
|
850
|
+
}
|
|
851
|
+
export function inputTokensDetailsFromJSON(
|
|
852
|
+
jsonString: string,
|
|
853
|
+
): SafeParseResult<InputTokensDetails, SDKValidationError> {
|
|
854
|
+
return safeParse(
|
|
855
|
+
jsonString,
|
|
856
|
+
(x) => InputTokensDetails$inboundSchema.parse(JSON.parse(x)),
|
|
857
|
+
`Failed to parse 'InputTokensDetails' from JSON`,
|
|
858
|
+
);
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/** @internal */
|
|
862
|
+
export const CreateImageUsage$inboundSchema: z.ZodType<
|
|
863
|
+
CreateImageUsage,
|
|
864
|
+
z.ZodTypeDef,
|
|
865
|
+
unknown
|
|
866
|
+
> = z.object({
|
|
867
|
+
input_tokens: z.number().optional(),
|
|
868
|
+
input_tokens_details: z.lazy(() => InputTokensDetails$inboundSchema),
|
|
869
|
+
output_tokens: z.number().optional(),
|
|
870
|
+
total_tokens: z.number().optional(),
|
|
871
|
+
}).transform((v) => {
|
|
872
|
+
return remap$(v, {
|
|
873
|
+
"input_tokens": "inputTokens",
|
|
874
|
+
"input_tokens_details": "inputTokensDetails",
|
|
875
|
+
"output_tokens": "outputTokens",
|
|
876
|
+
"total_tokens": "totalTokens",
|
|
877
|
+
});
|
|
878
|
+
});
|
|
879
|
+
/** @internal */
|
|
880
|
+
export type CreateImageUsage$Outbound = {
|
|
881
|
+
input_tokens?: number | undefined;
|
|
882
|
+
input_tokens_details: InputTokensDetails$Outbound;
|
|
883
|
+
output_tokens?: number | undefined;
|
|
884
|
+
total_tokens?: number | undefined;
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
/** @internal */
|
|
888
|
+
export const CreateImageUsage$outboundSchema: z.ZodType<
|
|
889
|
+
CreateImageUsage$Outbound,
|
|
890
|
+
z.ZodTypeDef,
|
|
891
|
+
CreateImageUsage
|
|
892
|
+
> = z.object({
|
|
893
|
+
inputTokens: z.number().optional(),
|
|
894
|
+
inputTokensDetails: z.lazy(() => InputTokensDetails$outboundSchema),
|
|
895
|
+
outputTokens: z.number().optional(),
|
|
896
|
+
totalTokens: z.number().optional(),
|
|
897
|
+
}).transform((v) => {
|
|
898
|
+
return remap$(v, {
|
|
899
|
+
inputTokens: "input_tokens",
|
|
900
|
+
inputTokensDetails: "input_tokens_details",
|
|
901
|
+
outputTokens: "output_tokens",
|
|
902
|
+
totalTokens: "total_tokens",
|
|
903
|
+
});
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
export function createImageUsageToJSON(
|
|
907
|
+
createImageUsage: CreateImageUsage,
|
|
908
|
+
): string {
|
|
909
|
+
return JSON.stringify(
|
|
910
|
+
CreateImageUsage$outboundSchema.parse(createImageUsage),
|
|
911
|
+
);
|
|
912
|
+
}
|
|
913
|
+
export function createImageUsageFromJSON(
|
|
914
|
+
jsonString: string,
|
|
915
|
+
): SafeParseResult<CreateImageUsage, SDKValidationError> {
|
|
916
|
+
return safeParse(
|
|
917
|
+
jsonString,
|
|
918
|
+
(x) => CreateImageUsage$inboundSchema.parse(JSON.parse(x)),
|
|
919
|
+
`Failed to parse 'CreateImageUsage' from JSON`,
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/** @internal */
|
|
924
|
+
export const CreateImageResponseBody$inboundSchema: z.ZodType<
|
|
925
|
+
CreateImageResponseBody,
|
|
926
|
+
z.ZodTypeDef,
|
|
927
|
+
unknown
|
|
928
|
+
> = z.object({
|
|
929
|
+
created: z.number(),
|
|
930
|
+
data: z.array(z.lazy(() => CreateImageData$inboundSchema)),
|
|
931
|
+
usage: z.lazy(() => CreateImageUsage$inboundSchema).optional(),
|
|
932
|
+
});
|
|
933
|
+
/** @internal */
|
|
934
|
+
export type CreateImageResponseBody$Outbound = {
|
|
935
|
+
created: number;
|
|
936
|
+
data: Array<CreateImageData$Outbound>;
|
|
937
|
+
usage?: CreateImageUsage$Outbound | undefined;
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
/** @internal */
|
|
941
|
+
export const CreateImageResponseBody$outboundSchema: z.ZodType<
|
|
942
|
+
CreateImageResponseBody$Outbound,
|
|
943
|
+
z.ZodTypeDef,
|
|
944
|
+
CreateImageResponseBody
|
|
945
|
+
> = z.object({
|
|
946
|
+
created: z.number(),
|
|
947
|
+
data: z.array(z.lazy(() => CreateImageData$outboundSchema)),
|
|
948
|
+
usage: z.lazy(() => CreateImageUsage$outboundSchema).optional(),
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
export function createImageResponseBodyToJSON(
|
|
952
|
+
createImageResponseBody: CreateImageResponseBody,
|
|
953
|
+
): string {
|
|
954
|
+
return JSON.stringify(
|
|
955
|
+
CreateImageResponseBody$outboundSchema.parse(createImageResponseBody),
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
export function createImageResponseBodyFromJSON(
|
|
959
|
+
jsonString: string,
|
|
960
|
+
): SafeParseResult<CreateImageResponseBody, SDKValidationError> {
|
|
961
|
+
return safeParse(
|
|
962
|
+
jsonString,
|
|
963
|
+
(x) => CreateImageResponseBody$inboundSchema.parse(JSON.parse(x)),
|
|
964
|
+
`Failed to parse 'CreateImageResponseBody' from JSON`,
|
|
965
|
+
);
|
|
966
|
+
}
|