@effect/ai-openai 4.0.0-beta.70 → 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.
- package/dist/OpenAiClient.d.ts +87 -3
- package/dist/OpenAiClient.d.ts.map +1 -1
- package/dist/OpenAiClient.js +118 -6
- package/dist/OpenAiClient.js.map +1 -1
- package/dist/OpenAiConfig.d.ts +84 -15
- package/dist/OpenAiConfig.d.ts.map +1 -1
- package/dist/OpenAiConfig.js +52 -15
- package/dist/OpenAiConfig.js.map +1 -1
- package/dist/OpenAiEmbeddingModel.d.ts +126 -2
- package/dist/OpenAiEmbeddingModel.d.ts.map +1 -1
- package/dist/OpenAiEmbeddingModel.js +100 -2
- package/dist/OpenAiEmbeddingModel.js.map +1 -1
- package/dist/OpenAiLanguageModel.d.ts +138 -9
- package/dist/OpenAiLanguageModel.d.ts.map +1 -1
- package/dist/OpenAiLanguageModel.js +106 -7
- package/dist/OpenAiLanguageModel.js.map +1 -1
- package/dist/OpenAiSchema.d.ts +281 -12
- package/dist/OpenAiSchema.d.ts.map +1 -1
- package/dist/OpenAiSchema.js +227 -4
- package/dist/OpenAiSchema.js.map +1 -1
- package/dist/OpenAiTelemetry.d.ts +29 -1
- package/dist/OpenAiTelemetry.d.ts.map +1 -1
- package/dist/OpenAiTelemetry.js +29 -4
- package/dist/OpenAiTelemetry.js.map +1 -1
- package/dist/OpenAiTool.d.ts +111 -5
- package/dist/OpenAiTool.d.ts.map +1 -1
- package/dist/OpenAiTool.js +111 -5
- package/dist/OpenAiTool.js.map +1 -1
- package/dist/index.d.ts +1 -49
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -49
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/OpenAiClient.ts +118 -6
- package/src/OpenAiConfig.ts +84 -15
- package/src/OpenAiEmbeddingModel.ts +152 -2
- package/src/OpenAiLanguageModel.ts +170 -11
- package/src/OpenAiSchema.ts +309 -4
- package/src/OpenAiTelemetry.ts +50 -5
- package/src/OpenAiTool.ts +111 -5
- package/src/index.ts +1 -49
package/dist/OpenAiSchema.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as Schema from "effect/Schema";
|
|
2
2
|
/**
|
|
3
|
-
* Schema for optional `include` values
|
|
3
|
+
* Schema for optional `include` values supported by the local handwritten
|
|
4
|
+
* Responses client schema.
|
|
4
5
|
*
|
|
5
6
|
* **Details**
|
|
6
7
|
*
|
|
7
|
-
* These values request additional response fields such as image URLs, encrypted
|
|
8
|
+
* These values request additional response fields such as image URLs, encrypted
|
|
9
|
+
* reasoning content, output logprobs, code interpreter outputs, or web search
|
|
10
|
+
* sources. This schema enumerates the include values supported by this client
|
|
11
|
+
* path.
|
|
8
12
|
*
|
|
9
13
|
* @category schemas
|
|
10
14
|
* @since 4.0.0
|
|
@@ -20,6 +24,11 @@ export type IncludeEnum = typeof IncludeEnum.Type;
|
|
|
20
24
|
/**
|
|
21
25
|
* Schema for lifecycle statuses shared by messages, reasoning items, and tool calls.
|
|
22
26
|
*
|
|
27
|
+
* **Details**
|
|
28
|
+
*
|
|
29
|
+
* Accepted values are `"in_progress"`, `"completed"`, and `"incomplete"`.
|
|
30
|
+
* This item-level status is used by message, reasoning, and tool-call shapes.
|
|
31
|
+
*
|
|
23
32
|
* @category schemas
|
|
24
33
|
* @since 4.0.0
|
|
25
34
|
*/
|
|
@@ -27,6 +36,10 @@ export declare const MessageStatus: Schema.Literals<readonly ["in_progress", "co
|
|
|
27
36
|
/**
|
|
28
37
|
* Lifecycle status shared by messages, reasoning items, and tool calls.
|
|
29
38
|
*
|
|
39
|
+
* **Details**
|
|
40
|
+
*
|
|
41
|
+
* Accepted values are `"in_progress"`, `"completed"`, and `"incomplete"`.
|
|
42
|
+
*
|
|
30
43
|
* @category models
|
|
31
44
|
* @since 4.0.0
|
|
32
45
|
*/
|
|
@@ -34,6 +47,12 @@ export type MessageStatus = typeof MessageStatus.Type;
|
|
|
34
47
|
/**
|
|
35
48
|
* Schema for content blocks accepted in OpenAI Responses input messages.
|
|
36
49
|
*
|
|
50
|
+
* **Details**
|
|
51
|
+
*
|
|
52
|
+
* Accepted block variants are `input_text`, `input_image`, and `input_file`.
|
|
53
|
+
*
|
|
54
|
+
* @see {@link InputItem} for request input item shapes that can contain these content blocks
|
|
55
|
+
*
|
|
37
56
|
* @category schemas
|
|
38
57
|
* @since 4.0.0
|
|
39
58
|
*/
|
|
@@ -55,6 +74,10 @@ export declare const InputContent: Schema.Union<readonly [Schema.Struct<{
|
|
|
55
74
|
/**
|
|
56
75
|
* Content block accepted in OpenAI Responses input messages.
|
|
57
76
|
*
|
|
77
|
+
* **Details**
|
|
78
|
+
*
|
|
79
|
+
* Accepted block variants are `input_text`, `input_image`, and `input_file`.
|
|
80
|
+
*
|
|
58
81
|
* @category models
|
|
59
82
|
* @since 4.0.0
|
|
60
83
|
*/
|
|
@@ -62,6 +85,13 @@ export type InputContent = typeof InputContent.Type;
|
|
|
62
85
|
/**
|
|
63
86
|
* Schema for a text block containing a model-provided reasoning summary.
|
|
64
87
|
*
|
|
88
|
+
* **Details**
|
|
89
|
+
*
|
|
90
|
+
* The decoded shape is `type: "summary_text"` plus `text` containing the
|
|
91
|
+
* reasoning summary text.
|
|
92
|
+
*
|
|
93
|
+
* @see {@link ReasoningItem} for reasoning output items that contain summary text blocks
|
|
94
|
+
*
|
|
65
95
|
* @category schemas
|
|
66
96
|
* @since 4.0.0
|
|
67
97
|
*/
|
|
@@ -79,6 +109,11 @@ export type SummaryTextContent = typeof SummaryTextContent.Type;
|
|
|
79
109
|
/**
|
|
80
110
|
* Schema for citation and file-path annotations attached to output text content.
|
|
81
111
|
*
|
|
112
|
+
* **Details**
|
|
113
|
+
*
|
|
114
|
+
* Accepts annotation objects discriminated by `type`: `file_citation`,
|
|
115
|
+
* `url_citation`, `container_file_citation`, or `file_path`.
|
|
116
|
+
*
|
|
82
117
|
* @category schemas
|
|
83
118
|
* @since 4.0.0
|
|
84
119
|
*/
|
|
@@ -108,6 +143,11 @@ export declare const Annotation: Schema.Union<readonly [Schema.Struct<{
|
|
|
108
143
|
/**
|
|
109
144
|
* Citation or file-path annotation attached to output text content.
|
|
110
145
|
*
|
|
146
|
+
* **Details**
|
|
147
|
+
*
|
|
148
|
+
* Accepted annotation variants are `file_citation`, `url_citation`,
|
|
149
|
+
* `container_file_citation`, and `file_path`.
|
|
150
|
+
*
|
|
111
151
|
* @category models
|
|
112
152
|
* @since 4.0.0
|
|
113
153
|
*/
|
|
@@ -115,6 +155,24 @@ export type Annotation = typeof Annotation.Type;
|
|
|
115
155
|
/**
|
|
116
156
|
* Schema for a reasoning output item containing encrypted content, summaries, and optional reasoning text.
|
|
117
157
|
*
|
|
158
|
+
* **When to use**
|
|
159
|
+
*
|
|
160
|
+
* Use when decoding or encoding OpenAI Responses reasoning items that may be
|
|
161
|
+
* carried into later request input.
|
|
162
|
+
*
|
|
163
|
+
* **Details**
|
|
164
|
+
*
|
|
165
|
+
* Reasoning items represent model reasoning content. `summary` is required,
|
|
166
|
+
* while `content` and `status` are optional.
|
|
167
|
+
*
|
|
168
|
+
* **Gotchas**
|
|
169
|
+
*
|
|
170
|
+
* `encrypted_content` is populated only when `reasoning.encrypted_content` is
|
|
171
|
+
* requested through `include`.
|
|
172
|
+
*
|
|
173
|
+
* @see {@link InputItem} for request input items that can carry reasoning items
|
|
174
|
+
* @see {@link IncludeEnum} for requesting encrypted reasoning content
|
|
175
|
+
*
|
|
118
176
|
* @category schemas
|
|
119
177
|
* @since 4.0.0
|
|
120
178
|
*/
|
|
@@ -135,6 +193,21 @@ export declare const ReasoningItem: Schema.Struct<{
|
|
|
135
193
|
/**
|
|
136
194
|
* Reasoning output item containing encrypted content, summaries, and optional reasoning text.
|
|
137
195
|
*
|
|
196
|
+
* **When to use**
|
|
197
|
+
*
|
|
198
|
+
* Use when typing OpenAI Responses reasoning items that may be carried into
|
|
199
|
+
* later request input.
|
|
200
|
+
*
|
|
201
|
+
* **Details**
|
|
202
|
+
*
|
|
203
|
+
* Reasoning items represent model reasoning content. `summary` is required,
|
|
204
|
+
* while `content` and `status` are optional.
|
|
205
|
+
*
|
|
206
|
+
* **Gotchas**
|
|
207
|
+
*
|
|
208
|
+
* `encrypted_content` is populated only when `reasoning.encrypted_content` is
|
|
209
|
+
* requested through `include`.
|
|
210
|
+
*
|
|
138
211
|
* @category models
|
|
139
212
|
* @since 4.0.0
|
|
140
213
|
*/
|
|
@@ -142,6 +215,19 @@ export type ReasoningItem = typeof ReasoningItem.Type;
|
|
|
142
215
|
/**
|
|
143
216
|
* Schema for item shapes accepted by an OpenAI Responses request `input` field.
|
|
144
217
|
*
|
|
218
|
+
* **When to use**
|
|
219
|
+
*
|
|
220
|
+
* Use when validating structured `CreateResponse.input` array items.
|
|
221
|
+
*
|
|
222
|
+
* **Details**
|
|
223
|
+
*
|
|
224
|
+
* Accepted item families include request/output messages, function call and
|
|
225
|
+
* function call output, reasoning items, item references, shell and local shell
|
|
226
|
+
* calls and outputs, apply-patch output, and MCP approval responses.
|
|
227
|
+
*
|
|
228
|
+
* @see {@link CreateResponse} for the request schema that consumes input items
|
|
229
|
+
* @see {@link InputContent} for content blocks inside message items
|
|
230
|
+
*
|
|
145
231
|
* @category schemas
|
|
146
232
|
* @since 4.0.0
|
|
147
233
|
*/
|
|
@@ -308,6 +394,16 @@ export declare const InputItem: Schema.Union<readonly [Schema.Struct<{
|
|
|
308
394
|
/**
|
|
309
395
|
* Item shape accepted by an OpenAI Responses request `input` field.
|
|
310
396
|
*
|
|
397
|
+
* **When to use**
|
|
398
|
+
*
|
|
399
|
+
* Use when typing structured `CreateResponse.input` array items.
|
|
400
|
+
*
|
|
401
|
+
* **Details**
|
|
402
|
+
*
|
|
403
|
+
* Accepted item families include request/output messages, function call and
|
|
404
|
+
* function call output, reasoning items, item references, shell and local shell
|
|
405
|
+
* calls and outputs, apply-patch output, and MCP approval responses.
|
|
406
|
+
*
|
|
311
407
|
* @category models
|
|
312
408
|
* @since 4.0.0
|
|
313
409
|
*/
|
|
@@ -315,6 +411,22 @@ export type InputItem = typeof InputItem.Type;
|
|
|
315
411
|
/**
|
|
316
412
|
* Schema for tool definitions that can be supplied to an OpenAI Responses request.
|
|
317
413
|
*
|
|
414
|
+
* **Details**
|
|
415
|
+
*
|
|
416
|
+
* Accepted variants are function tools, custom tools, and provider-defined
|
|
417
|
+
* OpenAI tools. Provider-defined `type` literals include `apply_patch`,
|
|
418
|
+
* `code_interpreter`, `file_search`, `image_generation`, `local_shell`, `mcp`,
|
|
419
|
+
* `shell`, `web_search`, and `web_search_preview`.
|
|
420
|
+
*
|
|
421
|
+
* **Gotchas**
|
|
422
|
+
*
|
|
423
|
+
* Provider-defined tools use `Schema.StructWithRest`, so this schema checks the
|
|
424
|
+
* provider tool `type` and permits additional provider fields rather than fully
|
|
425
|
+
* validating every provider-specific tool payload.
|
|
426
|
+
*
|
|
427
|
+
* @see {@link ToolChoice} for selecting whether and which tools the model may call
|
|
428
|
+
* @see {@link CreateResponse} for the request schema that consumes tools
|
|
429
|
+
*
|
|
318
430
|
* @category schemas
|
|
319
431
|
* @since 4.0.0
|
|
320
432
|
*/
|
|
@@ -342,6 +454,14 @@ export type Tool = typeof Tool.Type;
|
|
|
342
454
|
/**
|
|
343
455
|
* Schema for selecting whether and which tools the model may call in a Responses request.
|
|
344
456
|
*
|
|
457
|
+
* **Details**
|
|
458
|
+
*
|
|
459
|
+
* Accepted forms are `"none"`, `"auto"`, `"required"`, an allowed-tools set,
|
|
460
|
+
* a named function or custom tool, or a provider-defined tool choice.
|
|
461
|
+
*
|
|
462
|
+
* @see {@link Tool} for tool definitions referenced by tool choices
|
|
463
|
+
* @see {@link CreateResponse} for the request schema that consumes `tool_choice`
|
|
464
|
+
*
|
|
345
465
|
* @category schemas
|
|
346
466
|
* @since 4.0.0
|
|
347
467
|
*/
|
|
@@ -361,6 +481,11 @@ export declare const ToolChoice: Schema.Union<readonly [Schema.Literals<readonly
|
|
|
361
481
|
/**
|
|
362
482
|
* Tool selection mode or named tool choice for a Responses request.
|
|
363
483
|
*
|
|
484
|
+
* **Details**
|
|
485
|
+
*
|
|
486
|
+
* Accepted forms are `"none"`, `"auto"`, `"required"`, an allowed-tools set,
|
|
487
|
+
* a named function or custom tool, or a provider-defined tool choice.
|
|
488
|
+
*
|
|
364
489
|
* @category models
|
|
365
490
|
* @since 4.0.0
|
|
366
491
|
*/
|
|
@@ -368,6 +493,17 @@ export type ToolChoice = typeof ToolChoice.Type;
|
|
|
368
493
|
/**
|
|
369
494
|
* Schema for text output format configuration, including plain text, JSON object, and JSON Schema responses.
|
|
370
495
|
*
|
|
496
|
+
* **Details**
|
|
497
|
+
*
|
|
498
|
+
* Accepted variants are `text`, `json_schema`, and `json_object`.
|
|
499
|
+
*
|
|
500
|
+
* **Gotchas**
|
|
501
|
+
*
|
|
502
|
+
* `json_object` is the older JSON mode. Prefer `json_schema` for models that
|
|
503
|
+
* support it.
|
|
504
|
+
*
|
|
505
|
+
* @see {@link CreateResponse} for the request schema that consumes text format configuration
|
|
506
|
+
*
|
|
371
507
|
* @category schemas
|
|
372
508
|
* @since 4.0.0
|
|
373
509
|
*/
|
|
@@ -392,6 +528,25 @@ export type TextResponseFormatConfiguration = typeof TextResponseFormatConfigura
|
|
|
392
528
|
/**
|
|
393
529
|
* Schema for request options used to create an OpenAI Responses API response.
|
|
394
530
|
*
|
|
531
|
+
* **When to use**
|
|
532
|
+
*
|
|
533
|
+
* Use to validate or encode payloads sent to the OpenAI Responses API.
|
|
534
|
+
*
|
|
535
|
+
* **Details**
|
|
536
|
+
*
|
|
537
|
+
* Validates the Responses API request payload, including input content, model
|
|
538
|
+
* selection, instructions, reasoning options, text output format, tools,
|
|
539
|
+
* `tool_choice`, streaming, storage, response continuation, sampling options,
|
|
540
|
+
* and optional response fields requested through `include`.
|
|
541
|
+
*
|
|
542
|
+
* **Gotchas**
|
|
543
|
+
*
|
|
544
|
+
* When `stream` is `true`, the API returns stream events instead of a single
|
|
545
|
+
* response object.
|
|
546
|
+
*
|
|
547
|
+
* @see {@link Response} for decoded non-streaming response objects
|
|
548
|
+
* @see {@link ResponseStreamEvent} for decoded streaming event objects
|
|
549
|
+
*
|
|
395
550
|
* @category schemas
|
|
396
551
|
* @since 4.0.0
|
|
397
552
|
*/
|
|
@@ -632,6 +787,12 @@ export type CreateResponse = typeof CreateResponse.Type;
|
|
|
632
787
|
/**
|
|
633
788
|
* Schema for token accounting reported on OpenAI Responses API response objects.
|
|
634
789
|
*
|
|
790
|
+
* **Details**
|
|
791
|
+
*
|
|
792
|
+
* The required counters are `input_tokens`, `output_tokens`, and
|
|
793
|
+
* `total_tokens`. Provider-specific token detail objects are preserved through
|
|
794
|
+
* `input_tokens_details`, `output_tokens_details`, and additional fields.
|
|
795
|
+
*
|
|
635
796
|
* @category schemas
|
|
636
797
|
* @since 4.0.0
|
|
637
798
|
*/
|
|
@@ -645,6 +806,11 @@ export declare const ResponseUsage: Schema.StructWithRest<Schema.Struct<{
|
|
|
645
806
|
/**
|
|
646
807
|
* Token accounting reported on OpenAI Responses API response objects.
|
|
647
808
|
*
|
|
809
|
+
* **Details**
|
|
810
|
+
*
|
|
811
|
+
* Includes total input, output, and combined token counts, with provider-specific
|
|
812
|
+
* token detail fields preserved when present.
|
|
813
|
+
*
|
|
648
814
|
* @category models
|
|
649
815
|
* @since 4.0.0
|
|
650
816
|
*/
|
|
@@ -652,6 +818,19 @@ export type ResponseUsage = typeof ResponseUsage.Type;
|
|
|
652
818
|
/**
|
|
653
819
|
* Schema for an OpenAI Responses API response object.
|
|
654
820
|
*
|
|
821
|
+
* **When to use**
|
|
822
|
+
*
|
|
823
|
+
* Use to decode non-streaming OpenAI Responses API responses.
|
|
824
|
+
*
|
|
825
|
+
* **Details**
|
|
826
|
+
*
|
|
827
|
+
* Response objects include the response id, model, creation time, output items,
|
|
828
|
+
* optional token usage, optional incomplete details, and optional service tier.
|
|
829
|
+
*
|
|
830
|
+
* @see {@link CreateResponse} for the request schema that creates responses
|
|
831
|
+
* @see {@link ResponseUsage} for token accounting on responses
|
|
832
|
+
* @see {@link ResponseStreamEvent} for streaming response events
|
|
833
|
+
*
|
|
655
834
|
* @category schemas
|
|
656
835
|
* @since 4.0.0
|
|
657
836
|
*/
|
|
@@ -660,7 +839,7 @@ export declare const Response: Schema.Struct<{
|
|
|
660
839
|
readonly object: Schema.optionalKey<Schema.Literal<"response">>;
|
|
661
840
|
readonly model: Schema.String;
|
|
662
841
|
readonly created_at: Schema.Number;
|
|
663
|
-
readonly output: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
842
|
+
readonly output: Schema.withDecodingDefault<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
664
843
|
readonly id: Schema.String;
|
|
665
844
|
readonly type: Schema.Literal<"apply_patch_call">;
|
|
666
845
|
readonly call_id: Schema.String;
|
|
@@ -810,7 +989,7 @@ export declare const Response: Schema.Struct<{
|
|
|
810
989
|
readonly type: Schema.Literal<"web_search_call">;
|
|
811
990
|
readonly action: Schema.optionalKey<Schema.Unknown>;
|
|
812
991
|
readonly status: Schema.optionalKey<Schema.String>;
|
|
813
|
-
}>]
|
|
992
|
+
}>]>>, never>;
|
|
814
993
|
readonly usage: Schema.optionalKey<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
|
|
815
994
|
readonly input_tokens: Schema.Number;
|
|
816
995
|
readonly output_tokens: Schema.Number;
|
|
@@ -826,6 +1005,15 @@ export declare const Response: Schema.Struct<{
|
|
|
826
1005
|
/**
|
|
827
1006
|
* OpenAI Responses API response object.
|
|
828
1007
|
*
|
|
1008
|
+
* **When to use**
|
|
1009
|
+
*
|
|
1010
|
+
* Use when typing non-streaming OpenAI Responses API responses.
|
|
1011
|
+
*
|
|
1012
|
+
* **Details**
|
|
1013
|
+
*
|
|
1014
|
+
* Response objects include metadata, output items, optional token usage, and
|
|
1015
|
+
* optional incomplete details.
|
|
1016
|
+
*
|
|
829
1017
|
* @category models
|
|
830
1018
|
* @since 4.0.0
|
|
831
1019
|
*/
|
|
@@ -843,6 +1031,24 @@ export type UnknownResponseStreamEvent = {
|
|
|
843
1031
|
/**
|
|
844
1032
|
* Schema for server-sent event shapes emitted by OpenAI Responses API streams.
|
|
845
1033
|
*
|
|
1034
|
+
* **When to use**
|
|
1035
|
+
*
|
|
1036
|
+
* Use to decode events from a streaming OpenAI Responses API request.
|
|
1037
|
+
*
|
|
1038
|
+
* **Details**
|
|
1039
|
+
*
|
|
1040
|
+
* Known event variants include response lifecycle events, output item events,
|
|
1041
|
+
* text and reasoning deltas, tool-call deltas, partial image events, and error
|
|
1042
|
+
* events.
|
|
1043
|
+
*
|
|
1044
|
+
* **Gotchas**
|
|
1045
|
+
*
|
|
1046
|
+
* Future event types decode through the fallback only when their `type` is not
|
|
1047
|
+
* one of the known event types. Malformed known events still fail to decode.
|
|
1048
|
+
*
|
|
1049
|
+
* @see {@link Response} for complete response objects carried by lifecycle events
|
|
1050
|
+
* @see {@link UnknownResponseStreamEvent} for the fallback shape for future event types
|
|
1051
|
+
*
|
|
846
1052
|
* @category schemas
|
|
847
1053
|
* @since 4.0.0
|
|
848
1054
|
*/
|
|
@@ -853,7 +1059,7 @@ export declare const ResponseStreamEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
853
1059
|
readonly object: Schema.optionalKey<Schema.Literal<"response">>;
|
|
854
1060
|
readonly model: Schema.String;
|
|
855
1061
|
readonly created_at: Schema.Number;
|
|
856
|
-
readonly output: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1062
|
+
readonly output: Schema.withDecodingDefault<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
857
1063
|
readonly id: Schema.String;
|
|
858
1064
|
readonly type: Schema.Literal<"apply_patch_call">;
|
|
859
1065
|
readonly call_id: Schema.String;
|
|
@@ -1003,7 +1209,7 @@ export declare const ResponseStreamEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1003
1209
|
readonly type: Schema.Literal<"web_search_call">;
|
|
1004
1210
|
readonly action: Schema.optionalKey<Schema.Unknown>;
|
|
1005
1211
|
readonly status: Schema.optionalKey<Schema.String>;
|
|
1006
|
-
}>]
|
|
1212
|
+
}>]>>, never>;
|
|
1007
1213
|
readonly usage: Schema.optionalKey<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
|
|
1008
1214
|
readonly input_tokens: Schema.Number;
|
|
1009
1215
|
readonly output_tokens: Schema.Number;
|
|
@@ -1024,7 +1230,7 @@ export declare const ResponseStreamEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1024
1230
|
readonly object: Schema.optionalKey<Schema.Literal<"response">>;
|
|
1025
1231
|
readonly model: Schema.String;
|
|
1026
1232
|
readonly created_at: Schema.Number;
|
|
1027
|
-
readonly output: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1233
|
+
readonly output: Schema.withDecodingDefault<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1028
1234
|
readonly id: Schema.String;
|
|
1029
1235
|
readonly type: Schema.Literal<"apply_patch_call">;
|
|
1030
1236
|
readonly call_id: Schema.String;
|
|
@@ -1174,7 +1380,7 @@ export declare const ResponseStreamEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1174
1380
|
readonly type: Schema.Literal<"web_search_call">;
|
|
1175
1381
|
readonly action: Schema.optionalKey<Schema.Unknown>;
|
|
1176
1382
|
readonly status: Schema.optionalKey<Schema.String>;
|
|
1177
|
-
}>]
|
|
1383
|
+
}>]>>, never>;
|
|
1178
1384
|
readonly usage: Schema.optionalKey<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
|
|
1179
1385
|
readonly input_tokens: Schema.Number;
|
|
1180
1386
|
readonly output_tokens: Schema.Number;
|
|
@@ -1195,7 +1401,7 @@ export declare const ResponseStreamEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1195
1401
|
readonly object: Schema.optionalKey<Schema.Literal<"response">>;
|
|
1196
1402
|
readonly model: Schema.String;
|
|
1197
1403
|
readonly created_at: Schema.Number;
|
|
1198
|
-
readonly output: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1404
|
+
readonly output: Schema.withDecodingDefault<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1199
1405
|
readonly id: Schema.String;
|
|
1200
1406
|
readonly type: Schema.Literal<"apply_patch_call">;
|
|
1201
1407
|
readonly call_id: Schema.String;
|
|
@@ -1345,7 +1551,7 @@ export declare const ResponseStreamEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1345
1551
|
readonly type: Schema.Literal<"web_search_call">;
|
|
1346
1552
|
readonly action: Schema.optionalKey<Schema.Unknown>;
|
|
1347
1553
|
readonly status: Schema.optionalKey<Schema.String>;
|
|
1348
|
-
}>]
|
|
1554
|
+
}>]>>, never>;
|
|
1349
1555
|
readonly usage: Schema.optionalKey<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
|
|
1350
1556
|
readonly input_tokens: Schema.Number;
|
|
1351
1557
|
readonly output_tokens: Schema.Number;
|
|
@@ -1366,7 +1572,7 @@ export declare const ResponseStreamEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1366
1572
|
readonly object: Schema.optionalKey<Schema.Literal<"response">>;
|
|
1367
1573
|
readonly model: Schema.String;
|
|
1368
1574
|
readonly created_at: Schema.Number;
|
|
1369
|
-
readonly output: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1575
|
+
readonly output: Schema.withDecodingDefault<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1370
1576
|
readonly id: Schema.String;
|
|
1371
1577
|
readonly type: Schema.Literal<"apply_patch_call">;
|
|
1372
1578
|
readonly call_id: Schema.String;
|
|
@@ -1516,7 +1722,7 @@ export declare const ResponseStreamEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1516
1722
|
readonly type: Schema.Literal<"web_search_call">;
|
|
1517
1723
|
readonly action: Schema.optionalKey<Schema.Unknown>;
|
|
1518
1724
|
readonly status: Schema.optionalKey<Schema.String>;
|
|
1519
|
-
}>]
|
|
1725
|
+
}>]>>, never>;
|
|
1520
1726
|
readonly usage: Schema.optionalKey<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
|
|
1521
1727
|
readonly input_tokens: Schema.Number;
|
|
1522
1728
|
readonly output_tokens: Schema.Number;
|
|
@@ -1958,6 +2164,15 @@ export declare const ResponseStreamEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1958
2164
|
/**
|
|
1959
2165
|
* Server-sent event shape emitted by OpenAI Responses API streams.
|
|
1960
2166
|
*
|
|
2167
|
+
* **When to use**
|
|
2168
|
+
*
|
|
2169
|
+
* Use when typing events from a streaming OpenAI Responses API request.
|
|
2170
|
+
*
|
|
2171
|
+
* **Details**
|
|
2172
|
+
*
|
|
2173
|
+
* Includes known response stream events plus a fallback shape for unknown future
|
|
2174
|
+
* event types.
|
|
2175
|
+
*
|
|
1961
2176
|
* @category models
|
|
1962
2177
|
* @since 4.0.0
|
|
1963
2178
|
*/
|
|
@@ -1965,6 +2180,16 @@ export type ResponseStreamEvent = typeof ResponseStreamEvent.Type;
|
|
|
1965
2180
|
/**
|
|
1966
2181
|
* Schema for one embedding item returned by the OpenAI embeddings API.
|
|
1967
2182
|
*
|
|
2183
|
+
* **Details**
|
|
2184
|
+
*
|
|
2185
|
+
* An embedding item contains its `index`, optional `object` marker, and an
|
|
2186
|
+
* `embedding` represented either as a numeric vector or as a string.
|
|
2187
|
+
*
|
|
2188
|
+
* **Gotchas**
|
|
2189
|
+
*
|
|
2190
|
+
* Callers that need numeric vectors must account for string embeddings, such as
|
|
2191
|
+
* base64-encoded embeddings returned for string encoding formats.
|
|
2192
|
+
*
|
|
1968
2193
|
* @category schemas
|
|
1969
2194
|
* @since 4.0.0
|
|
1970
2195
|
*/
|
|
@@ -1976,6 +2201,11 @@ export declare const Embedding: Schema.Struct<{
|
|
|
1976
2201
|
/**
|
|
1977
2202
|
* One embedding item returned by the OpenAI embeddings API.
|
|
1978
2203
|
*
|
|
2204
|
+
* **Details**
|
|
2205
|
+
*
|
|
2206
|
+
* Contains the item index and embedding payload. The embedding payload may be a
|
|
2207
|
+
* numeric vector or a string.
|
|
2208
|
+
*
|
|
1979
2209
|
* @category models
|
|
1980
2210
|
* @since 4.0.0
|
|
1981
2211
|
*/
|
|
@@ -1983,6 +2213,18 @@ export type Embedding = typeof Embedding.Type;
|
|
|
1983
2213
|
/**
|
|
1984
2214
|
* Schema for the request payload sent to the OpenAI embeddings endpoint.
|
|
1985
2215
|
*
|
|
2216
|
+
* **Details**
|
|
2217
|
+
*
|
|
2218
|
+
* Requires `input` and `model`. `input` may be a string, an array of strings,
|
|
2219
|
+
* a token array, or an array of token arrays. Optional fields configure the
|
|
2220
|
+
* embedding encoding format, requested dimensions, and user identifier.
|
|
2221
|
+
*
|
|
2222
|
+
* **Gotchas**
|
|
2223
|
+
*
|
|
2224
|
+
* This schema validates the transport shape, but OpenAI still enforces
|
|
2225
|
+
* provider-side constraints such as non-empty input, integer token ids, input
|
|
2226
|
+
* size limits, positive dimensions, and model-specific dimension support.
|
|
2227
|
+
*
|
|
1986
2228
|
* @category schemas
|
|
1987
2229
|
* @since 4.0.0
|
|
1988
2230
|
*/
|
|
@@ -2003,6 +2245,24 @@ export type CreateEmbeddingRequest = typeof CreateEmbeddingRequest.Type;
|
|
|
2003
2245
|
/**
|
|
2004
2246
|
* Schema for a successful response payload returned by the OpenAI embeddings endpoint.
|
|
2005
2247
|
*
|
|
2248
|
+
* **When to use**
|
|
2249
|
+
*
|
|
2250
|
+
* Use to decode successful OpenAI embeddings responses.
|
|
2251
|
+
*
|
|
2252
|
+
* **Details**
|
|
2253
|
+
*
|
|
2254
|
+
* The response contains an array of `Embedding` items, the model name, an
|
|
2255
|
+
* optional `object: "list"` marker, and optional token usage counts for prompt
|
|
2256
|
+
* and total tokens.
|
|
2257
|
+
*
|
|
2258
|
+
* **Gotchas**
|
|
2259
|
+
*
|
|
2260
|
+
* Each `Embedding` may contain either a numeric vector or a string embedding.
|
|
2261
|
+
* Callers that require numeric vectors must account for string embeddings.
|
|
2262
|
+
*
|
|
2263
|
+
* @see {@link CreateEmbeddingRequest} for the request schema sent to the embeddings endpoint
|
|
2264
|
+
* @see {@link Embedding} for individual embedding items in the response
|
|
2265
|
+
*
|
|
2006
2266
|
* @category schemas
|
|
2007
2267
|
* @since 4.0.0
|
|
2008
2268
|
*/
|
|
@@ -2022,6 +2282,15 @@ export declare const CreateEmbeddingResponse: Schema.Struct<{
|
|
|
2022
2282
|
/**
|
|
2023
2283
|
* Successful response payload returned by the OpenAI embeddings endpoint.
|
|
2024
2284
|
*
|
|
2285
|
+
* **When to use**
|
|
2286
|
+
*
|
|
2287
|
+
* Use when typing successful OpenAI embeddings responses.
|
|
2288
|
+
*
|
|
2289
|
+
* **Details**
|
|
2290
|
+
*
|
|
2291
|
+
* Contains embedding items, the model name, optional list marker, and optional
|
|
2292
|
+
* token usage counts.
|
|
2293
|
+
*
|
|
2025
2294
|
* @category models
|
|
2026
2295
|
* @since 4.0.0
|
|
2027
2296
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAiSchema.d.ts","sourceRoot":"","sources":["../src/OpenAiSchema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OpenAiSchema.d.ts","sourceRoot":"","sources":["../src/OpenAiSchema.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAUvC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,+LAMtB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,sEAA8D,CAAA;AAExF;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;AAsBrD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;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