@effect/ai-openai 4.0.0-beta.7 → 4.0.0-beta.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/Generated.d.ts +66734 -37723
  2. package/dist/Generated.d.ts.map +1 -1
  3. package/dist/Generated.js +1 -1
  4. package/dist/Generated.js.map +1 -1
  5. package/dist/OpenAiClient.d.ts +167 -27
  6. package/dist/OpenAiClient.d.ts.map +1 -1
  7. package/dist/OpenAiClient.js +337 -44
  8. package/dist/OpenAiClient.js.map +1 -1
  9. package/dist/OpenAiClientGenerated.d.ts +91 -0
  10. package/dist/OpenAiClientGenerated.d.ts.map +1 -0
  11. package/dist/OpenAiClientGenerated.js +84 -0
  12. package/dist/OpenAiClientGenerated.js.map +1 -0
  13. package/dist/OpenAiConfig.d.ts +114 -10
  14. package/dist/OpenAiConfig.d.ts.map +1 -1
  15. package/dist/OpenAiConfig.js +68 -7
  16. package/dist/OpenAiConfig.js.map +1 -1
  17. package/dist/OpenAiEmbeddingModel.d.ts +213 -0
  18. package/dist/OpenAiEmbeddingModel.d.ts.map +1 -0
  19. package/dist/OpenAiEmbeddingModel.js +219 -0
  20. package/dist/OpenAiEmbeddingModel.js.map +1 -0
  21. package/dist/OpenAiError.d.ts +168 -35
  22. package/dist/OpenAiError.d.ts.map +1 -1
  23. package/dist/OpenAiError.js +1 -1
  24. package/dist/OpenAiLanguageModel.d.ts +384 -62
  25. package/dist/OpenAiLanguageModel.d.ts.map +1 -1
  26. package/dist/OpenAiLanguageModel.js +416 -166
  27. package/dist/OpenAiLanguageModel.js.map +1 -1
  28. package/dist/OpenAiSchema.d.ts +2298 -0
  29. package/dist/OpenAiSchema.d.ts.map +1 -0
  30. package/dist/OpenAiSchema.js +814 -0
  31. package/dist/OpenAiSchema.js.map +1 -0
  32. package/dist/OpenAiTelemetry.d.ts +59 -18
  33. package/dist/OpenAiTelemetry.d.ts.map +1 -1
  34. package/dist/OpenAiTelemetry.js +35 -8
  35. package/dist/OpenAiTelemetry.js.map +1 -1
  36. package/dist/OpenAiTool.d.ts +157 -62
  37. package/dist/OpenAiTool.d.ts.map +1 -1
  38. package/dist/OpenAiTool.js +134 -39
  39. package/dist/OpenAiTool.js.map +1 -1
  40. package/dist/index.d.ts +19 -33
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +19 -33
  43. package/dist/index.js.map +1 -1
  44. package/dist/internal/errors.js +4 -4
  45. package/dist/internal/errors.js.map +1 -1
  46. package/package.json +3 -3
  47. package/src/Generated.ts +9858 -5044
  48. package/src/OpenAiClient.ts +513 -95
  49. package/src/OpenAiClientGenerated.ts +202 -0
  50. package/src/OpenAiConfig.ts +115 -11
  51. package/src/OpenAiEmbeddingModel.ts +357 -0
  52. package/src/OpenAiError.ts +170 -35
  53. package/src/OpenAiLanguageModel.ts +802 -167
  54. package/src/OpenAiSchema.ts +1289 -0
  55. package/src/OpenAiTelemetry.ts +81 -23
  56. package/src/OpenAiTool.ts +135 -40
  57. package/src/index.ts +22 -33
  58. package/src/internal/errors.ts +6 -4
@@ -0,0 +1,814 @@
1
+ /**
2
+ * The `OpenAiSchema` module defines the request, response, streaming, and
3
+ * embedding schemas used by the handwritten OpenAI client. These schemas are
4
+ * the transport boundary for JSON sent to and decoded from the Responses and
5
+ * embeddings endpoints.
6
+ *
7
+ * **Mental model**
8
+ *
9
+ * - Request schemas such as {@link CreateResponse} and
10
+ * {@link CreateEmbeddingRequest} describe the encoded payloads sent to OpenAI.
11
+ * - Response schemas such as {@link Response}, {@link ResponseStreamEvent}, and
12
+ * {@link CreateEmbeddingResponse} describe provider data after schema
13
+ * decoding.
14
+ * - Shared schemas such as {@link InputItem}, {@link Tool}, and
15
+ * {@link TextResponseFormatConfiguration} cover the message, tool, and output
16
+ * format fragments reused across request and response shapes.
17
+ *
18
+ * **Common tasks**
19
+ *
20
+ * - Use {@link CreateResponse} with {@link Response} for non-streaming
21
+ * Responses API calls.
22
+ * - Use {@link ResponseStreamEvent} for server-sent events emitted by streaming
23
+ * Responses API calls.
24
+ * - Use {@link CreateEmbeddingRequest} and {@link CreateEmbeddingResponse} for
25
+ * embeddings endpoint payloads.
26
+ * - Use smaller schemas like {@link IncludeEnum}, {@link InputContent}, and
27
+ * {@link ToolChoice} when validating request fragments.
28
+ *
29
+ * **Gotchas**
30
+ *
31
+ * - The module models the subset of OpenAI shapes supported by this client
32
+ * path; it is not a complete mirror of every OpenAI REST API field.
33
+ * - Unknown future stream event types decode through
34
+ * {@link UnknownResponseStreamEvent}, while malformed known event types still
35
+ * fail schema decoding.
36
+ *
37
+ * @since 4.0.0
38
+ */
39
+ import * as Effect from "effect/Effect";
40
+ import * as Predicate from "effect/Predicate";
41
+ import * as Schema from "effect/Schema";
42
+ const UnknownRecord = /*#__PURE__*/Schema.Record(Schema.String, Schema.Unknown);
43
+ const JsonObject = /*#__PURE__*/Schema.Record(Schema.String, Schema.Unknown);
44
+ const MessageRole = /*#__PURE__*/Schema.Literals(["system", "developer", "user", "assistant"]);
45
+ const ImageDetail = /*#__PURE__*/Schema.Literals(["low", "high", "auto"]);
46
+ /**
47
+ * Schema for optional `include` values supported by the local handwritten
48
+ * Responses client schema.
49
+ *
50
+ * **Details**
51
+ *
52
+ * These values request additional response fields such as image URLs, encrypted
53
+ * reasoning content, output logprobs, code interpreter outputs, or web search
54
+ * sources. This schema enumerates the include values supported by this client
55
+ * path.
56
+ *
57
+ * @category schemas
58
+ * @since 4.0.0
59
+ */
60
+ export const IncludeEnum = /*#__PURE__*/Schema.Literals(["message.input_image.image_url", "reasoning.encrypted_content", "message.output_text.logprobs", "code_interpreter_call.outputs", "web_search_call.action.sources"]);
61
+ /**
62
+ * Schema for lifecycle statuses shared by messages, reasoning items, and tool calls.
63
+ *
64
+ * **Details**
65
+ *
66
+ * Accepted values are `"in_progress"`, `"completed"`, and `"incomplete"`.
67
+ * This item-level status is used by message, reasoning, and tool-call shapes.
68
+ *
69
+ * @category schemas
70
+ * @since 4.0.0
71
+ */
72
+ export const MessageStatus = /*#__PURE__*/Schema.Literals(["in_progress", "completed", "incomplete"]);
73
+ const InputTextContent = /*#__PURE__*/Schema.Struct({
74
+ type: /*#__PURE__*/Schema.Literal("input_text"),
75
+ text: Schema.String
76
+ });
77
+ const InputImageContent = /*#__PURE__*/Schema.Struct({
78
+ type: /*#__PURE__*/Schema.Literal("input_image"),
79
+ image_url: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
80
+ file_id: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
81
+ detail: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(ImageDetail))
82
+ });
83
+ const InputFileContent = /*#__PURE__*/Schema.Struct({
84
+ type: /*#__PURE__*/Schema.Literal("input_file"),
85
+ file_id: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
86
+ filename: /*#__PURE__*/Schema.optionalKey(Schema.String),
87
+ file_url: /*#__PURE__*/Schema.optionalKey(Schema.String),
88
+ file_data: /*#__PURE__*/Schema.optionalKey(Schema.String)
89
+ });
90
+ /**
91
+ * Schema for content blocks accepted in OpenAI Responses input messages.
92
+ *
93
+ * **Details**
94
+ *
95
+ * Accepted block variants are `input_text`, `input_image`, and `input_file`.
96
+ *
97
+ * @see {@link InputItem} for request input item shapes that can contain these content blocks
98
+ *
99
+ * @category schemas
100
+ * @since 4.0.0
101
+ */
102
+ export const InputContent = /*#__PURE__*/Schema.Union([InputTextContent, InputImageContent, InputFileContent]);
103
+ /**
104
+ * Schema for a text block containing a model-provided reasoning summary.
105
+ *
106
+ * **Details**
107
+ *
108
+ * The decoded shape is `type: "summary_text"` plus `text` containing the
109
+ * reasoning summary text.
110
+ *
111
+ * @see {@link ReasoningItem} for reasoning output items that contain summary text blocks
112
+ *
113
+ * @category schemas
114
+ * @since 4.0.0
115
+ */
116
+ export const SummaryTextContent = /*#__PURE__*/Schema.Struct({
117
+ type: /*#__PURE__*/Schema.Literal("summary_text"),
118
+ text: Schema.String
119
+ });
120
+ const ReasoningTextContent = /*#__PURE__*/Schema.Struct({
121
+ type: /*#__PURE__*/Schema.Literal("reasoning_text"),
122
+ text: Schema.String
123
+ });
124
+ const RefusalContent = /*#__PURE__*/Schema.Struct({
125
+ type: /*#__PURE__*/Schema.Literal("refusal"),
126
+ refusal: Schema.String
127
+ });
128
+ const TextContent = /*#__PURE__*/Schema.Struct({
129
+ type: /*#__PURE__*/Schema.Literal("text"),
130
+ text: Schema.String
131
+ });
132
+ const ComputerScreenshotContent = /*#__PURE__*/Schema.Struct({
133
+ type: /*#__PURE__*/Schema.Literal("computer_screenshot"),
134
+ image_url: /*#__PURE__*/Schema.NullOr(Schema.String),
135
+ file_id: /*#__PURE__*/Schema.NullOr(Schema.String)
136
+ });
137
+ const FileCitationAnnotation = /*#__PURE__*/Schema.Struct({
138
+ type: /*#__PURE__*/Schema.Literal("file_citation"),
139
+ file_id: Schema.String,
140
+ index: Schema.Number,
141
+ filename: Schema.String
142
+ });
143
+ const UrlCitationAnnotation = /*#__PURE__*/Schema.Struct({
144
+ type: /*#__PURE__*/Schema.Literal("url_citation"),
145
+ url: Schema.String,
146
+ start_index: Schema.Number,
147
+ end_index: Schema.Number,
148
+ title: Schema.String
149
+ });
150
+ const ContainerFileCitationAnnotation = /*#__PURE__*/Schema.Struct({
151
+ type: /*#__PURE__*/Schema.Literal("container_file_citation"),
152
+ container_id: Schema.String,
153
+ file_id: Schema.String,
154
+ start_index: Schema.Number,
155
+ end_index: Schema.Number,
156
+ filename: Schema.String
157
+ });
158
+ const FilePathAnnotation = /*#__PURE__*/Schema.Struct({
159
+ type: /*#__PURE__*/Schema.Literal("file_path"),
160
+ file_id: Schema.String,
161
+ index: Schema.Number
162
+ });
163
+ /**
164
+ * Schema for citation and file-path annotations attached to output text content.
165
+ *
166
+ * **Details**
167
+ *
168
+ * Accepts annotation objects discriminated by `type`: `file_citation`,
169
+ * `url_citation`, `container_file_citation`, or `file_path`.
170
+ *
171
+ * @category schemas
172
+ * @since 4.0.0
173
+ */
174
+ export const Annotation = /*#__PURE__*/Schema.Union([FileCitationAnnotation, UrlCitationAnnotation, ContainerFileCitationAnnotation, FilePathAnnotation]);
175
+ const OutputTextContent = /*#__PURE__*/Schema.Struct({
176
+ type: /*#__PURE__*/Schema.Literal("output_text"),
177
+ text: Schema.String,
178
+ annotations: /*#__PURE__*/Schema.Array(Annotation),
179
+ logprobs: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(Schema.Unknown))
180
+ });
181
+ const OutputMessageContent = /*#__PURE__*/Schema.Union([InputTextContent, OutputTextContent, TextContent, SummaryTextContent, ReasoningTextContent, RefusalContent, InputImageContent, ComputerScreenshotContent, InputFileContent]);
182
+ const OutputMessage = /*#__PURE__*/Schema.Struct({
183
+ id: Schema.String,
184
+ type: /*#__PURE__*/Schema.Literal("message"),
185
+ role: /*#__PURE__*/Schema.Literal("assistant"),
186
+ content: /*#__PURE__*/Schema.Array(OutputMessageContent),
187
+ status: MessageStatus
188
+ });
189
+ /**
190
+ * Schema for a reasoning output item containing encrypted content, summaries, and optional reasoning text.
191
+ *
192
+ * **When to use**
193
+ *
194
+ * Use when decoding or encoding OpenAI Responses reasoning items that may be
195
+ * carried into later request input.
196
+ *
197
+ * **Details**
198
+ *
199
+ * Reasoning items represent model reasoning content. `summary` is required,
200
+ * while `content` and `status` are optional.
201
+ *
202
+ * **Gotchas**
203
+ *
204
+ * `encrypted_content` is populated only when `reasoning.encrypted_content` is
205
+ * requested through `include`.
206
+ *
207
+ * @see {@link InputItem} for request input items that can carry reasoning items
208
+ * @see {@link IncludeEnum} for requesting encrypted reasoning content
209
+ *
210
+ * @category schemas
211
+ * @since 4.0.0
212
+ */
213
+ export const ReasoningItem = /*#__PURE__*/Schema.Struct({
214
+ type: /*#__PURE__*/Schema.Literal("reasoning"),
215
+ id: Schema.String,
216
+ encrypted_content: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
217
+ summary: /*#__PURE__*/Schema.Array(SummaryTextContent),
218
+ content: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(ReasoningTextContent)),
219
+ status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
220
+ });
221
+ const FunctionCall = /*#__PURE__*/Schema.Struct({
222
+ id: /*#__PURE__*/Schema.optionalKey(Schema.String),
223
+ type: /*#__PURE__*/Schema.Literal("function_call"),
224
+ call_id: Schema.String,
225
+ name: Schema.String,
226
+ arguments: Schema.String,
227
+ status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
228
+ });
229
+ const FunctionCallOutput = /*#__PURE__*/Schema.Struct({
230
+ id: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
231
+ type: /*#__PURE__*/Schema.Literal("function_call_output"),
232
+ call_id: Schema.String,
233
+ output: /*#__PURE__*/Schema.Union([Schema.String, /*#__PURE__*/Schema.Array(InputContent)]),
234
+ status: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(MessageStatus))
235
+ });
236
+ const ItemReference = /*#__PURE__*/Schema.Struct({
237
+ type: /*#__PURE__*/Schema.Literal("item_reference"),
238
+ id: Schema.String
239
+ });
240
+ const LocalShellCall = /*#__PURE__*/Schema.Struct({
241
+ id: /*#__PURE__*/Schema.optionalKey(Schema.String),
242
+ type: /*#__PURE__*/Schema.Literal("local_shell_call"),
243
+ call_id: Schema.String,
244
+ action: Schema.Unknown,
245
+ status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
246
+ });
247
+ const LocalShellCallOutput = /*#__PURE__*/Schema.Struct({
248
+ id: /*#__PURE__*/Schema.optionalKey(Schema.String),
249
+ type: /*#__PURE__*/Schema.Literal("local_shell_call_output"),
250
+ call_id: Schema.String,
251
+ output: Schema.Unknown,
252
+ status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
253
+ });
254
+ const ShellCall = /*#__PURE__*/Schema.Struct({
255
+ id: /*#__PURE__*/Schema.optionalKey(Schema.String),
256
+ type: /*#__PURE__*/Schema.Literal("shell_call"),
257
+ call_id: Schema.String,
258
+ action: Schema.Unknown,
259
+ status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
260
+ });
261
+ const ShellCallOutput = /*#__PURE__*/Schema.Struct({
262
+ id: /*#__PURE__*/Schema.optionalKey(Schema.String),
263
+ type: /*#__PURE__*/Schema.Literal("shell_call_output"),
264
+ call_id: Schema.String,
265
+ output: Schema.Unknown,
266
+ status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
267
+ });
268
+ const ApplyPatchCallOutput = /*#__PURE__*/Schema.Struct({
269
+ id: /*#__PURE__*/Schema.optionalKey(Schema.String),
270
+ type: /*#__PURE__*/Schema.Literal("apply_patch_call_output"),
271
+ call_id: Schema.String,
272
+ status: /*#__PURE__*/Schema.optionalKey(MessageStatus),
273
+ output: /*#__PURE__*/Schema.optionalKey(Schema.Unknown)
274
+ });
275
+ const McpApprovalResponse = /*#__PURE__*/Schema.Struct({
276
+ type: /*#__PURE__*/Schema.Literal("mcp_approval_response"),
277
+ approval_request_id: Schema.String,
278
+ approve: Schema.Boolean
279
+ });
280
+ const RequestMessageItem = /*#__PURE__*/Schema.Struct({
281
+ type: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Literal("message")),
282
+ role: MessageRole,
283
+ status: /*#__PURE__*/Schema.optionalKey(MessageStatus),
284
+ content: /*#__PURE__*/Schema.Union([Schema.String, /*#__PURE__*/Schema.Array(InputContent)])
285
+ });
286
+ /**
287
+ * Schema for item shapes accepted by an OpenAI Responses request `input` field.
288
+ *
289
+ * **When to use**
290
+ *
291
+ * Use when validating structured `CreateResponse.input` array items.
292
+ *
293
+ * **Details**
294
+ *
295
+ * Accepted item families include request/output messages, function call and
296
+ * function call output, reasoning items, item references, shell and local shell
297
+ * calls and outputs, apply-patch output, and MCP approval responses.
298
+ *
299
+ * @see {@link CreateResponse} for the request schema that consumes input items
300
+ * @see {@link InputContent} for content blocks inside message items
301
+ *
302
+ * @category schemas
303
+ * @since 4.0.0
304
+ */
305
+ export const InputItem = /*#__PURE__*/Schema.Union([RequestMessageItem, OutputMessage, FunctionCall, FunctionCallOutput, ReasoningItem, ItemReference, LocalShellCall, LocalShellCallOutput, ShellCall, ShellCallOutput, ApplyPatchCallOutput, McpApprovalResponse]);
306
+ const FunctionTool = /*#__PURE__*/Schema.Struct({
307
+ type: /*#__PURE__*/Schema.Literal("function"),
308
+ name: Schema.String,
309
+ description: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
310
+ parameters: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(JsonObject)),
311
+ strict: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.Boolean))
312
+ });
313
+ const CustomTool = /*#__PURE__*/Schema.Struct({
314
+ type: /*#__PURE__*/Schema.Literal("custom"),
315
+ name: Schema.String,
316
+ description: /*#__PURE__*/Schema.optionalKey(Schema.String),
317
+ format: /*#__PURE__*/Schema.optionalKey(Schema.Unknown)
318
+ });
319
+ const ProviderDefinedTool = /*#__PURE__*/Schema.StructWithRest(/*#__PURE__*/Schema.Struct({
320
+ type: /*#__PURE__*/Schema.Literals(["apply_patch", "code_interpreter", "file_search", "image_generation", "local_shell", "mcp", "shell", "web_search", "web_search_preview"])
321
+ }), [UnknownRecord]);
322
+ /**
323
+ * Schema for tool definitions that can be supplied to an OpenAI Responses request.
324
+ *
325
+ * **Details**
326
+ *
327
+ * Accepted variants are function tools, custom tools, and provider-defined
328
+ * OpenAI tools. Provider-defined `type` literals include `apply_patch`,
329
+ * `code_interpreter`, `file_search`, `image_generation`, `local_shell`, `mcp`,
330
+ * `shell`, `web_search`, and `web_search_preview`.
331
+ *
332
+ * **Gotchas**
333
+ *
334
+ * Provider-defined tools use `Schema.StructWithRest`, so this schema checks the
335
+ * provider tool `type` and permits additional provider fields rather than fully
336
+ * validating every provider-specific tool payload.
337
+ *
338
+ * @see {@link ToolChoice} for selecting whether and which tools the model may call
339
+ * @see {@link CreateResponse} for the request schema that consumes tools
340
+ *
341
+ * @category schemas
342
+ * @since 4.0.0
343
+ */
344
+ export const Tool = /*#__PURE__*/Schema.Union([FunctionTool, CustomTool, ProviderDefinedTool]);
345
+ /**
346
+ * Schema for selecting whether and which tools the model may call in a Responses request.
347
+ *
348
+ * **Details**
349
+ *
350
+ * Accepted forms are `"none"`, `"auto"`, `"required"`, an allowed-tools set,
351
+ * a named function or custom tool, or a provider-defined tool choice.
352
+ *
353
+ * @see {@link Tool} for tool definitions referenced by tool choices
354
+ * @see {@link CreateResponse} for the request schema that consumes `tool_choice`
355
+ *
356
+ * @category schemas
357
+ * @since 4.0.0
358
+ */
359
+ export const ToolChoice = /*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Literals(["none", "auto", "required"]), /*#__PURE__*/Schema.Struct({
360
+ type: /*#__PURE__*/Schema.Literal("allowed_tools"),
361
+ mode: /*#__PURE__*/Schema.Literals(["auto", "required"]),
362
+ tools: /*#__PURE__*/Schema.Array(JsonObject)
363
+ }), /*#__PURE__*/Schema.Struct({
364
+ type: /*#__PURE__*/Schema.Literal("function"),
365
+ name: Schema.String
366
+ }), /*#__PURE__*/Schema.Struct({
367
+ type: /*#__PURE__*/Schema.Literal("custom"),
368
+ name: Schema.String
369
+ }), /*#__PURE__*/Schema.StructWithRest(/*#__PURE__*/Schema.Struct({
370
+ type: /*#__PURE__*/Schema.Literals(["apply_patch", "code_interpreter", "file_search", "image_generation", "local_shell", "mcp", "shell", "web_search", "web_search_preview"])
371
+ }), [UnknownRecord])]);
372
+ /**
373
+ * Schema for text output format configuration, including plain text, JSON object, and JSON Schema responses.
374
+ *
375
+ * **Details**
376
+ *
377
+ * Accepted variants are `text`, `json_schema`, and `json_object`.
378
+ *
379
+ * **Gotchas**
380
+ *
381
+ * `json_object` is the older JSON mode. Prefer `json_schema` for models that
382
+ * support it.
383
+ *
384
+ * @see {@link CreateResponse} for the request schema that consumes text format configuration
385
+ *
386
+ * @category schemas
387
+ * @since 4.0.0
388
+ */
389
+ export const TextResponseFormatConfiguration = /*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Struct({
390
+ type: /*#__PURE__*/Schema.Literal("text")
391
+ }), /*#__PURE__*/Schema.Struct({
392
+ type: /*#__PURE__*/Schema.Literal("json_schema"),
393
+ description: /*#__PURE__*/Schema.optionalKey(Schema.String),
394
+ name: Schema.String,
395
+ schema: JsonObject,
396
+ strict: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.Boolean))
397
+ }), /*#__PURE__*/Schema.Struct({
398
+ type: /*#__PURE__*/Schema.Literal("json_object")
399
+ })]);
400
+ /**
401
+ * Schema for request options used to create an OpenAI Responses API response.
402
+ *
403
+ * **When to use**
404
+ *
405
+ * Use to validate or encode payloads sent to the OpenAI Responses API.
406
+ *
407
+ * **Details**
408
+ *
409
+ * Validates the Responses API request payload, including input content, model
410
+ * selection, instructions, reasoning options, text output format, tools,
411
+ * `tool_choice`, streaming, storage, response continuation, sampling options,
412
+ * and optional response fields requested through `include`.
413
+ *
414
+ * **Gotchas**
415
+ *
416
+ * When `stream` is `true`, the API returns stream events instead of a single
417
+ * response object.
418
+ *
419
+ * @see {@link Response} for decoded non-streaming response objects
420
+ * @see {@link ResponseStreamEvent} for decoded streaming event objects
421
+ *
422
+ * @category schemas
423
+ * @since 4.0.0
424
+ */
425
+ export const CreateResponse = /*#__PURE__*/Schema.Struct({
426
+ metadata: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record(Schema.String, Schema.String)),
427
+ top_logprobs: /*#__PURE__*/Schema.optional(Schema.Number),
428
+ temperature: /*#__PURE__*/Schema.optional(Schema.Number),
429
+ top_p: /*#__PURE__*/Schema.optional(Schema.Number),
430
+ user: /*#__PURE__*/Schema.optional(Schema.String),
431
+ service_tier: /*#__PURE__*/Schema.optional(Schema.String),
432
+ previous_response_id: /*#__PURE__*/Schema.optional(Schema.String),
433
+ model: /*#__PURE__*/Schema.optional(Schema.String),
434
+ reasoning: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Struct({
435
+ effort: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literals(["none", "minimal", "low", "medium", "high", "xhigh"])),
436
+ summary: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literals(["auto", "concise", "detailed"])),
437
+ generate_summary: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literals(["auto", "concise", "detailed"]))
438
+ })),
439
+ background: /*#__PURE__*/Schema.optional(Schema.Boolean),
440
+ max_output_tokens: /*#__PURE__*/Schema.optional(Schema.Number),
441
+ max_tool_calls: /*#__PURE__*/Schema.optional(Schema.Number),
442
+ text: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Struct({
443
+ format: /*#__PURE__*/Schema.optional(TextResponseFormatConfiguration),
444
+ verbosity: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literals(["low", "medium", "high"]))
445
+ })),
446
+ tools: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(Tool)),
447
+ tool_choice: /*#__PURE__*/Schema.optional(ToolChoice),
448
+ truncation: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literals(["auto", "disabled"])),
449
+ input: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Union([Schema.String, /*#__PURE__*/Schema.Array(InputItem)])),
450
+ include: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(IncludeEnum)),
451
+ store: /*#__PURE__*/Schema.optional(Schema.Boolean),
452
+ instructions: /*#__PURE__*/Schema.optional(Schema.String),
453
+ stream: /*#__PURE__*/Schema.optional(Schema.Boolean),
454
+ conversation: /*#__PURE__*/Schema.optional(Schema.String),
455
+ modalities: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(/*#__PURE__*/Schema.Literals(["text", "audio"]))),
456
+ seed: /*#__PURE__*/Schema.optional(Schema.Number)
457
+ });
458
+ /**
459
+ * Schema for token accounting reported on OpenAI Responses API response objects.
460
+ *
461
+ * **Details**
462
+ *
463
+ * The required counters are `input_tokens`, `output_tokens`, and
464
+ * `total_tokens`. Provider-specific token detail objects are preserved through
465
+ * `input_tokens_details`, `output_tokens_details`, and additional fields.
466
+ *
467
+ * @category schemas
468
+ * @since 4.0.0
469
+ */
470
+ export const ResponseUsage = /*#__PURE__*/Schema.StructWithRest(/*#__PURE__*/Schema.Struct({
471
+ input_tokens: Schema.Number,
472
+ output_tokens: Schema.Number,
473
+ total_tokens: Schema.Number,
474
+ input_tokens_details: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
475
+ output_tokens_details: /*#__PURE__*/Schema.optionalKey(Schema.Unknown)
476
+ }), [UnknownRecord]);
477
+ const ApplyPatchOperation = /*#__PURE__*/Schema.Struct({
478
+ type: Schema.String,
479
+ path: Schema.String,
480
+ diff: /*#__PURE__*/Schema.optionalKey(Schema.String)
481
+ });
482
+ const ApplyPatchCall = /*#__PURE__*/Schema.Struct({
483
+ id: Schema.String,
484
+ type: /*#__PURE__*/Schema.Literal("apply_patch_call"),
485
+ call_id: Schema.String,
486
+ operation: ApplyPatchOperation,
487
+ status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
488
+ });
489
+ const CodeInterpreterCall = /*#__PURE__*/Schema.Struct({
490
+ id: Schema.String,
491
+ type: /*#__PURE__*/Schema.Literal("code_interpreter_call"),
492
+ code: /*#__PURE__*/Schema.optionalKey(Schema.String),
493
+ container_id: Schema.String,
494
+ outputs: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(Schema.Unknown)),
495
+ status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
496
+ });
497
+ const ComputerCall = /*#__PURE__*/Schema.Struct({
498
+ id: Schema.String,
499
+ type: /*#__PURE__*/Schema.Literal("computer_call"),
500
+ status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
501
+ });
502
+ const FileSearchCall = /*#__PURE__*/Schema.Struct({
503
+ id: Schema.String,
504
+ type: /*#__PURE__*/Schema.Literal("file_search_call"),
505
+ status: /*#__PURE__*/Schema.optionalKey(Schema.String),
506
+ queries: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(Schema.String)),
507
+ results: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.Unknown))
508
+ });
509
+ const ImageGenerationCall = /*#__PURE__*/Schema.Struct({
510
+ id: Schema.String,
511
+ type: /*#__PURE__*/Schema.Literal("image_generation_call"),
512
+ result: /*#__PURE__*/Schema.optionalKey(Schema.String),
513
+ status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
514
+ });
515
+ const McpCall = /*#__PURE__*/Schema.Struct({
516
+ id: Schema.String,
517
+ type: /*#__PURE__*/Schema.Literal("mcp_call"),
518
+ approval_request_id: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
519
+ name: Schema.String,
520
+ arguments: Schema.Unknown,
521
+ output: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
522
+ error: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
523
+ server_label: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String))
524
+ });
525
+ const McpListTools = /*#__PURE__*/Schema.Struct({
526
+ id: Schema.String,
527
+ type: /*#__PURE__*/Schema.Literal("mcp_list_tools")
528
+ });
529
+ const McpApprovalRequest = /*#__PURE__*/Schema.Struct({
530
+ id: Schema.String,
531
+ type: /*#__PURE__*/Schema.Literal("mcp_approval_request"),
532
+ approval_request_id: /*#__PURE__*/Schema.optionalKey(Schema.String),
533
+ name: Schema.String,
534
+ arguments: Schema.Unknown
535
+ });
536
+ const WebSearchCall = /*#__PURE__*/Schema.Struct({
537
+ id: Schema.String,
538
+ type: /*#__PURE__*/Schema.Literal("web_search_call"),
539
+ action: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
540
+ status: /*#__PURE__*/Schema.optionalKey(Schema.String)
541
+ });
542
+ const OutputItem = /*#__PURE__*/Schema.Union([ApplyPatchCall, CodeInterpreterCall, ComputerCall, FileSearchCall, FunctionCall, ImageGenerationCall, LocalShellCall, McpCall, McpListTools, McpApprovalRequest, OutputMessage, ReasoningItem, ShellCall, WebSearchCall]);
543
+ /**
544
+ * Schema for an OpenAI Responses API response object.
545
+ *
546
+ * **When to use**
547
+ *
548
+ * Use to decode non-streaming OpenAI Responses API responses.
549
+ *
550
+ * **Details**
551
+ *
552
+ * Response objects include the response id, model, creation time, output items,
553
+ * optional token usage, optional incomplete details, and optional service tier.
554
+ *
555
+ * @see {@link CreateResponse} for the request schema that creates responses
556
+ * @see {@link ResponseUsage} for token accounting on responses
557
+ * @see {@link ResponseStreamEvent} for streaming response events
558
+ *
559
+ * @category schemas
560
+ * @since 4.0.0
561
+ */
562
+ export const Response = /*#__PURE__*/Schema.Struct({
563
+ id: Schema.String,
564
+ object: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Literal("response")),
565
+ model: Schema.String,
566
+ created_at: Schema.Number,
567
+ output: /*#__PURE__*/Schema.Array(OutputItem).pipe(/*#__PURE__*/Schema.withDecodingDefault(/*#__PURE__*/Effect.succeed([]))),
568
+ usage: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(ResponseUsage)),
569
+ incomplete_details: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(/*#__PURE__*/Schema.Struct({
570
+ reason: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Literals(["max_output_tokens", "content_filter"]))
571
+ }))),
572
+ service_tier: /*#__PURE__*/Schema.optionalKey(Schema.String)
573
+ });
574
+ const ResponseCreatedEvent = /*#__PURE__*/Schema.Struct({
575
+ type: /*#__PURE__*/Schema.Literal("response.created"),
576
+ response: Response,
577
+ sequence_number: Schema.Number
578
+ });
579
+ const ResponseCompletedEvent = /*#__PURE__*/Schema.Struct({
580
+ type: /*#__PURE__*/Schema.Literal("response.completed"),
581
+ response: Response,
582
+ sequence_number: Schema.Number
583
+ });
584
+ const ResponseIncompleteEvent = /*#__PURE__*/Schema.Struct({
585
+ type: /*#__PURE__*/Schema.Literal("response.incomplete"),
586
+ response: Response,
587
+ sequence_number: Schema.Number
588
+ });
589
+ const ResponseFailedEvent = /*#__PURE__*/Schema.Struct({
590
+ type: /*#__PURE__*/Schema.Literal("response.failed"),
591
+ response: Response,
592
+ sequence_number: Schema.Number
593
+ });
594
+ const ResponseOutputItemAddedEvent = /*#__PURE__*/Schema.Struct({
595
+ type: /*#__PURE__*/Schema.Literal("response.output_item.added"),
596
+ output_index: Schema.Number,
597
+ sequence_number: Schema.Number,
598
+ item: OutputItem
599
+ });
600
+ const ResponseOutputItemDoneEvent = /*#__PURE__*/Schema.Struct({
601
+ type: /*#__PURE__*/Schema.Literal("response.output_item.done"),
602
+ output_index: Schema.Number,
603
+ sequence_number: Schema.Number,
604
+ item: OutputItem
605
+ });
606
+ const ResponseOutputTextDeltaEvent = /*#__PURE__*/Schema.Struct({
607
+ type: /*#__PURE__*/Schema.Literal("response.output_text.delta"),
608
+ item_id: Schema.String,
609
+ output_index: Schema.Number,
610
+ content_index: Schema.Number,
611
+ delta: Schema.String,
612
+ sequence_number: Schema.Number,
613
+ logprobs: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(Schema.Unknown))
614
+ });
615
+ const ResponseOutputTextAnnotationAddedEvent = /*#__PURE__*/Schema.Struct({
616
+ type: /*#__PURE__*/Schema.Literal("response.output_text.annotation.added"),
617
+ item_id: Schema.String,
618
+ output_index: Schema.Number,
619
+ content_index: Schema.Number,
620
+ annotation_index: Schema.Number,
621
+ sequence_number: Schema.Number,
622
+ annotation: Annotation
623
+ });
624
+ const ResponseReasoningSummaryPartAddedEvent = /*#__PURE__*/Schema.Struct({
625
+ type: /*#__PURE__*/Schema.Literal("response.reasoning_summary_part.added"),
626
+ item_id: Schema.String,
627
+ output_index: Schema.Number,
628
+ summary_index: Schema.Number,
629
+ sequence_number: Schema.Number,
630
+ part: SummaryTextContent
631
+ });
632
+ const ResponseReasoningSummaryPartDoneEvent = /*#__PURE__*/Schema.Struct({
633
+ type: /*#__PURE__*/Schema.Literal("response.reasoning_summary_part.done"),
634
+ item_id: Schema.String,
635
+ output_index: Schema.Number,
636
+ summary_index: Schema.Number,
637
+ sequence_number: Schema.Number,
638
+ part: SummaryTextContent
639
+ });
640
+ const ResponseReasoningSummaryTextDeltaEvent = /*#__PURE__*/Schema.Struct({
641
+ type: /*#__PURE__*/Schema.Literal("response.reasoning_summary_text.delta"),
642
+ item_id: Schema.String,
643
+ output_index: Schema.Number,
644
+ summary_index: Schema.Number,
645
+ delta: Schema.String,
646
+ sequence_number: Schema.Number
647
+ });
648
+ const ResponseFunctionCallArgumentsDeltaEvent = /*#__PURE__*/Schema.Struct({
649
+ type: /*#__PURE__*/Schema.Literal("response.function_call_arguments.delta"),
650
+ item_id: Schema.String,
651
+ output_index: Schema.Number,
652
+ sequence_number: Schema.Number,
653
+ delta: Schema.String
654
+ });
655
+ const ResponseFunctionCallArgumentsDoneEvent = /*#__PURE__*/Schema.Struct({
656
+ type: /*#__PURE__*/Schema.Literal("response.function_call_arguments.done"),
657
+ item_id: Schema.String,
658
+ output_index: Schema.Number,
659
+ sequence_number: Schema.Number,
660
+ arguments: Schema.String
661
+ });
662
+ const ResponseCodeInterpreterCallCodeDeltaEvent = /*#__PURE__*/Schema.Struct({
663
+ type: /*#__PURE__*/Schema.Literal("response.code_interpreter_call_code.delta"),
664
+ item_id: Schema.String,
665
+ output_index: Schema.Number,
666
+ sequence_number: Schema.Number,
667
+ delta: Schema.String
668
+ });
669
+ const ResponseCodeInterpreterCallCodeDoneEvent = /*#__PURE__*/Schema.Struct({
670
+ type: /*#__PURE__*/Schema.Literal("response.code_interpreter_call_code.done"),
671
+ item_id: Schema.String,
672
+ output_index: Schema.Number,
673
+ sequence_number: Schema.Number,
674
+ code: Schema.String
675
+ });
676
+ const ResponseApplyPatchCallOperationDiffDeltaEvent = /*#__PURE__*/Schema.Struct({
677
+ type: /*#__PURE__*/Schema.Literal("response.apply_patch_call_operation_diff.delta"),
678
+ item_id: Schema.String,
679
+ output_index: Schema.Number,
680
+ sequence_number: Schema.Number,
681
+ delta: Schema.String
682
+ });
683
+ const ResponseApplyPatchCallOperationDiffDoneEvent = /*#__PURE__*/Schema.Struct({
684
+ type: /*#__PURE__*/Schema.Literal("response.apply_patch_call_operation_diff.done"),
685
+ item_id: Schema.String,
686
+ output_index: Schema.Number,
687
+ sequence_number: Schema.Number,
688
+ delta: /*#__PURE__*/Schema.optionalKey(Schema.String)
689
+ });
690
+ const ResponseImageGenerationCallPartialImageEvent = /*#__PURE__*/Schema.Struct({
691
+ type: /*#__PURE__*/Schema.Literal("response.image_generation_call.partial_image"),
692
+ item_id: Schema.String,
693
+ output_index: Schema.Number,
694
+ sequence_number: Schema.Number,
695
+ partial_image_b64: Schema.String
696
+ });
697
+ const ResponseErrorEvent = /*#__PURE__*/Schema.Struct({
698
+ type: /*#__PURE__*/Schema.Literal("error"),
699
+ code: /*#__PURE__*/Schema.NullOr(Schema.String),
700
+ message: Schema.String,
701
+ param: /*#__PURE__*/Schema.NullOr(Schema.String),
702
+ sequence_number: Schema.Number,
703
+ status: /*#__PURE__*/Schema.optionalKey(Schema.Number)
704
+ });
705
+ const knownResponseStreamEventTypes = /*#__PURE__*/new Set(["response.created", "response.completed", "response.incomplete", "response.failed", "response.output_item.added", "response.output_item.done", "response.output_text.delta", "response.output_text.annotation.added", "response.reasoning_summary_part.added", "response.reasoning_summary_part.done", "response.reasoning_summary_text.delta", "response.function_call_arguments.delta", "response.function_call_arguments.done", "response.code_interpreter_call_code.delta", "response.code_interpreter_call_code.done", "response.apply_patch_call_operation_diff.delta", "response.apply_patch_call_operation_diff.done", "response.image_generation_call.partial_image", "error"]);
706
+ const UnknownResponseStreamEvent = /*#__PURE__*/Schema.declare(value => Predicate.hasProperty(value, "type") && typeof value.type === "string" && !knownResponseStreamEventTypes.has(value.type), {
707
+ identifier: "UnknownResponseStreamEvent",
708
+ description: "Fallback for unknown future stream events"
709
+ });
710
+ /**
711
+ * Schema for server-sent event shapes emitted by OpenAI Responses API streams.
712
+ *
713
+ * **When to use**
714
+ *
715
+ * Use to decode events from a streaming OpenAI Responses API request.
716
+ *
717
+ * **Details**
718
+ *
719
+ * Known event variants include response lifecycle events, output item events,
720
+ * text and reasoning deltas, tool-call deltas, partial image events, and error
721
+ * events.
722
+ *
723
+ * **Gotchas**
724
+ *
725
+ * Future event types decode through the fallback only when their `type` is not
726
+ * one of the known event types. Malformed known events still fail to decode.
727
+ *
728
+ * @see {@link Response} for complete response objects carried by lifecycle events
729
+ * @see {@link UnknownResponseStreamEvent} for the fallback shape for future event types
730
+ *
731
+ * @category schemas
732
+ * @since 4.0.0
733
+ */
734
+ export const ResponseStreamEvent = /*#__PURE__*/Schema.Union([ResponseCreatedEvent, ResponseCompletedEvent, ResponseIncompleteEvent, ResponseFailedEvent, ResponseOutputItemAddedEvent, ResponseOutputItemDoneEvent, ResponseOutputTextDeltaEvent, ResponseOutputTextAnnotationAddedEvent, ResponseReasoningSummaryPartAddedEvent, ResponseReasoningSummaryPartDoneEvent, ResponseReasoningSummaryTextDeltaEvent, ResponseFunctionCallArgumentsDeltaEvent, ResponseFunctionCallArgumentsDoneEvent, ResponseCodeInterpreterCallCodeDeltaEvent, ResponseCodeInterpreterCallCodeDoneEvent, ResponseApplyPatchCallOperationDiffDeltaEvent, ResponseApplyPatchCallOperationDiffDoneEvent, ResponseImageGenerationCallPartialImageEvent, ResponseErrorEvent, UnknownResponseStreamEvent]);
735
+ /**
736
+ * Schema for one embedding item returned by the OpenAI embeddings API.
737
+ *
738
+ * **Details**
739
+ *
740
+ * An embedding item contains its `index`, optional `object` marker, and an
741
+ * `embedding` represented either as a numeric vector or as a string.
742
+ *
743
+ * **Gotchas**
744
+ *
745
+ * Callers that need numeric vectors must account for string embeddings, such as
746
+ * base64-encoded embeddings returned for string encoding formats.
747
+ *
748
+ * @category schemas
749
+ * @since 4.0.0
750
+ */
751
+ export const Embedding = /*#__PURE__*/Schema.Struct({
752
+ embedding: /*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Array(Schema.Number), Schema.String]),
753
+ index: Schema.Number,
754
+ object: /*#__PURE__*/Schema.optionalKey(Schema.String)
755
+ });
756
+ /**
757
+ * Schema for the request payload sent to the OpenAI embeddings endpoint.
758
+ *
759
+ * **Details**
760
+ *
761
+ * Requires `input` and `model`. `input` may be a string, an array of strings,
762
+ * a token array, or an array of token arrays. Optional fields configure the
763
+ * embedding encoding format, requested dimensions, and user identifier.
764
+ *
765
+ * **Gotchas**
766
+ *
767
+ * This schema validates the transport shape, but OpenAI still enforces
768
+ * provider-side constraints such as non-empty input, integer token ids, input
769
+ * size limits, positive dimensions, and model-specific dimension support.
770
+ *
771
+ * @category schemas
772
+ * @since 4.0.0
773
+ */
774
+ export const CreateEmbeddingRequest = /*#__PURE__*/Schema.Struct({
775
+ input: /*#__PURE__*/Schema.Union([Schema.String, /*#__PURE__*/Schema.Array(Schema.String), /*#__PURE__*/Schema.Array(Schema.Number), /*#__PURE__*/Schema.Array(/*#__PURE__*/Schema.Array(Schema.Number))]),
776
+ model: Schema.String,
777
+ encoding_format: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Literals(["float", "base64"])),
778
+ dimensions: /*#__PURE__*/Schema.optionalKey(Schema.Number),
779
+ user: /*#__PURE__*/Schema.optionalKey(Schema.String)
780
+ });
781
+ /**
782
+ * Schema for a successful response payload returned by the OpenAI embeddings endpoint.
783
+ *
784
+ * **When to use**
785
+ *
786
+ * Use to decode successful OpenAI embeddings responses.
787
+ *
788
+ * **Details**
789
+ *
790
+ * The response contains an array of `Embedding` items, the model name, an
791
+ * optional `object: "list"` marker, and optional token usage counts for prompt
792
+ * and total tokens.
793
+ *
794
+ * **Gotchas**
795
+ *
796
+ * Each `Embedding` may contain either a numeric vector or a string embedding.
797
+ * Callers that require numeric vectors must account for string embeddings.
798
+ *
799
+ * @see {@link CreateEmbeddingRequest} for the request schema sent to the embeddings endpoint
800
+ * @see {@link Embedding} for individual embedding items in the response
801
+ *
802
+ * @category schemas
803
+ * @since 4.0.0
804
+ */
805
+ export const CreateEmbeddingResponse = /*#__PURE__*/Schema.Struct({
806
+ data: /*#__PURE__*/Schema.Array(Embedding),
807
+ model: Schema.String,
808
+ object: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Literal("list")),
809
+ usage: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Struct({
810
+ prompt_tokens: Schema.Number,
811
+ total_tokens: Schema.Number
812
+ }))
813
+ });
814
+ //# sourceMappingURL=OpenAiSchema.js.map