@effect/ai-openai 4.0.0-beta.7 → 4.0.0-beta.70
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/Generated.d.ts +66734 -37723
- package/dist/Generated.d.ts.map +1 -1
- package/dist/Generated.js +1 -1
- package/dist/Generated.js.map +1 -1
- package/dist/OpenAiClient.d.ts +81 -25
- package/dist/OpenAiClient.d.ts.map +1 -1
- package/dist/OpenAiClient.js +220 -39
- package/dist/OpenAiClient.js.map +1 -1
- package/dist/OpenAiClientGenerated.d.ts +91 -0
- package/dist/OpenAiClientGenerated.d.ts.map +1 -0
- package/dist/OpenAiClientGenerated.js +84 -0
- package/dist/OpenAiClientGenerated.js.map +1 -0
- package/dist/OpenAiConfig.d.ts +45 -10
- package/dist/OpenAiConfig.d.ts.map +1 -1
- package/dist/OpenAiConfig.js +31 -7
- package/dist/OpenAiConfig.js.map +1 -1
- package/dist/OpenAiEmbeddingModel.d.ts +89 -0
- package/dist/OpenAiEmbeddingModel.d.ts.map +1 -0
- package/dist/OpenAiEmbeddingModel.js +121 -0
- package/dist/OpenAiEmbeddingModel.js.map +1 -0
- package/dist/OpenAiError.d.ts +168 -35
- package/dist/OpenAiError.d.ts.map +1 -1
- package/dist/OpenAiError.js +1 -1
- package/dist/OpenAiLanguageModel.d.ts +250 -57
- package/dist/OpenAiLanguageModel.d.ts.map +1 -1
- package/dist/OpenAiLanguageModel.js +311 -160
- package/dist/OpenAiLanguageModel.js.map +1 -1
- package/dist/OpenAiSchema.d.ts +2029 -0
- package/dist/OpenAiSchema.d.ts.map +1 -0
- package/dist/OpenAiSchema.js +591 -0
- package/dist/OpenAiSchema.js.map +1 -0
- package/dist/OpenAiTelemetry.d.ts +31 -18
- package/dist/OpenAiTelemetry.d.ts.map +1 -1
- package/dist/OpenAiTelemetry.js +6 -4
- package/dist/OpenAiTelemetry.js.map +1 -1
- package/dist/OpenAiTool.d.ts +56 -67
- package/dist/OpenAiTool.d.ts.map +1 -1
- package/dist/OpenAiTool.js +33 -44
- package/dist/OpenAiTool.js.map +1 -1
- package/dist/index.d.ts +42 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -8
- package/dist/index.js.map +1 -1
- package/dist/internal/errors.js +4 -4
- package/dist/internal/errors.js.map +1 -1
- package/package.json +3 -3
- package/src/Generated.ts +9858 -5044
- package/src/OpenAiClient.ts +396 -90
- package/src/OpenAiClientGenerated.ts +202 -0
- package/src/OpenAiConfig.ts +46 -11
- package/src/OpenAiEmbeddingModel.ts +207 -0
- package/src/OpenAiError.ts +170 -35
- package/src/OpenAiLanguageModel.ts +633 -157
- package/src/OpenAiSchema.ts +984 -0
- package/src/OpenAiTelemetry.ts +32 -19
- package/src/OpenAiTool.ts +34 -45
- package/src/index.ts +45 -8
- package/src/internal/errors.ts +6 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenAiSchema.d.ts","sourceRoot":"","sources":["../src/OpenAiSchema.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAUvC;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,+LAMtB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,sEAA8D,CAAA;AAExF;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;AAsBrD;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;IAIvB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;EAG7B,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC,IAAI,CAAA;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AAE7C;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;;EAWjC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC,IAAI,CAAA;AAEvE;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;EAUlC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAC,IAAI,CAAA"}
|
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal local OpenAI schemas used by the handwritten Responses client path.
|
|
3
|
+
*
|
|
4
|
+
* @since 4.0.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Predicate from "effect/Predicate";
|
|
7
|
+
import * as Schema from "effect/Schema";
|
|
8
|
+
const UnknownRecord = /*#__PURE__*/Schema.Record(Schema.String, Schema.Unknown);
|
|
9
|
+
const JsonObject = /*#__PURE__*/Schema.Record(Schema.String, Schema.Unknown);
|
|
10
|
+
const MessageRole = /*#__PURE__*/Schema.Literals(["system", "developer", "user", "assistant"]);
|
|
11
|
+
const ImageDetail = /*#__PURE__*/Schema.Literals(["low", "high", "auto"]);
|
|
12
|
+
/**
|
|
13
|
+
* Schema for optional `include` values on OpenAI Responses requests.
|
|
14
|
+
*
|
|
15
|
+
* **Details**
|
|
16
|
+
*
|
|
17
|
+
* These values request additional response fields such as image URLs, encrypted reasoning content, output logprobs, code interpreter outputs, or web search sources.
|
|
18
|
+
*
|
|
19
|
+
* @category schemas
|
|
20
|
+
* @since 4.0.0
|
|
21
|
+
*/
|
|
22
|
+
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"]);
|
|
23
|
+
/**
|
|
24
|
+
* Schema for lifecycle statuses shared by messages, reasoning items, and tool calls.
|
|
25
|
+
*
|
|
26
|
+
* @category schemas
|
|
27
|
+
* @since 4.0.0
|
|
28
|
+
*/
|
|
29
|
+
export const MessageStatus = /*#__PURE__*/Schema.Literals(["in_progress", "completed", "incomplete"]);
|
|
30
|
+
const InputTextContent = /*#__PURE__*/Schema.Struct({
|
|
31
|
+
type: /*#__PURE__*/Schema.Literal("input_text"),
|
|
32
|
+
text: Schema.String
|
|
33
|
+
});
|
|
34
|
+
const InputImageContent = /*#__PURE__*/Schema.Struct({
|
|
35
|
+
type: /*#__PURE__*/Schema.Literal("input_image"),
|
|
36
|
+
image_url: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
|
|
37
|
+
file_id: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
|
|
38
|
+
detail: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(ImageDetail))
|
|
39
|
+
});
|
|
40
|
+
const InputFileContent = /*#__PURE__*/Schema.Struct({
|
|
41
|
+
type: /*#__PURE__*/Schema.Literal("input_file"),
|
|
42
|
+
file_id: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
|
|
43
|
+
filename: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
44
|
+
file_url: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
45
|
+
file_data: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Schema for content blocks accepted in OpenAI Responses input messages.
|
|
49
|
+
*
|
|
50
|
+
* @category schemas
|
|
51
|
+
* @since 4.0.0
|
|
52
|
+
*/
|
|
53
|
+
export const InputContent = /*#__PURE__*/Schema.Union([InputTextContent, InputImageContent, InputFileContent]);
|
|
54
|
+
/**
|
|
55
|
+
* Schema for a text block containing a model-provided reasoning summary.
|
|
56
|
+
*
|
|
57
|
+
* @category schemas
|
|
58
|
+
* @since 4.0.0
|
|
59
|
+
*/
|
|
60
|
+
export const SummaryTextContent = /*#__PURE__*/Schema.Struct({
|
|
61
|
+
type: /*#__PURE__*/Schema.Literal("summary_text"),
|
|
62
|
+
text: Schema.String
|
|
63
|
+
});
|
|
64
|
+
const ReasoningTextContent = /*#__PURE__*/Schema.Struct({
|
|
65
|
+
type: /*#__PURE__*/Schema.Literal("reasoning_text"),
|
|
66
|
+
text: Schema.String
|
|
67
|
+
});
|
|
68
|
+
const RefusalContent = /*#__PURE__*/Schema.Struct({
|
|
69
|
+
type: /*#__PURE__*/Schema.Literal("refusal"),
|
|
70
|
+
refusal: Schema.String
|
|
71
|
+
});
|
|
72
|
+
const TextContent = /*#__PURE__*/Schema.Struct({
|
|
73
|
+
type: /*#__PURE__*/Schema.Literal("text"),
|
|
74
|
+
text: Schema.String
|
|
75
|
+
});
|
|
76
|
+
const ComputerScreenshotContent = /*#__PURE__*/Schema.Struct({
|
|
77
|
+
type: /*#__PURE__*/Schema.Literal("computer_screenshot"),
|
|
78
|
+
image_url: /*#__PURE__*/Schema.NullOr(Schema.String),
|
|
79
|
+
file_id: /*#__PURE__*/Schema.NullOr(Schema.String)
|
|
80
|
+
});
|
|
81
|
+
const FileCitationAnnotation = /*#__PURE__*/Schema.Struct({
|
|
82
|
+
type: /*#__PURE__*/Schema.Literal("file_citation"),
|
|
83
|
+
file_id: Schema.String,
|
|
84
|
+
index: Schema.Number,
|
|
85
|
+
filename: Schema.String
|
|
86
|
+
});
|
|
87
|
+
const UrlCitationAnnotation = /*#__PURE__*/Schema.Struct({
|
|
88
|
+
type: /*#__PURE__*/Schema.Literal("url_citation"),
|
|
89
|
+
url: Schema.String,
|
|
90
|
+
start_index: Schema.Number,
|
|
91
|
+
end_index: Schema.Number,
|
|
92
|
+
title: Schema.String
|
|
93
|
+
});
|
|
94
|
+
const ContainerFileCitationAnnotation = /*#__PURE__*/Schema.Struct({
|
|
95
|
+
type: /*#__PURE__*/Schema.Literal("container_file_citation"),
|
|
96
|
+
container_id: Schema.String,
|
|
97
|
+
file_id: Schema.String,
|
|
98
|
+
start_index: Schema.Number,
|
|
99
|
+
end_index: Schema.Number,
|
|
100
|
+
filename: Schema.String
|
|
101
|
+
});
|
|
102
|
+
const FilePathAnnotation = /*#__PURE__*/Schema.Struct({
|
|
103
|
+
type: /*#__PURE__*/Schema.Literal("file_path"),
|
|
104
|
+
file_id: Schema.String,
|
|
105
|
+
index: Schema.Number
|
|
106
|
+
});
|
|
107
|
+
/**
|
|
108
|
+
* Schema for citation and file-path annotations attached to output text content.
|
|
109
|
+
*
|
|
110
|
+
* @category schemas
|
|
111
|
+
* @since 4.0.0
|
|
112
|
+
*/
|
|
113
|
+
export const Annotation = /*#__PURE__*/Schema.Union([FileCitationAnnotation, UrlCitationAnnotation, ContainerFileCitationAnnotation, FilePathAnnotation]);
|
|
114
|
+
const OutputTextContent = /*#__PURE__*/Schema.Struct({
|
|
115
|
+
type: /*#__PURE__*/Schema.Literal("output_text"),
|
|
116
|
+
text: Schema.String,
|
|
117
|
+
annotations: /*#__PURE__*/Schema.Array(Annotation),
|
|
118
|
+
logprobs: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(Schema.Unknown))
|
|
119
|
+
});
|
|
120
|
+
const OutputMessageContent = /*#__PURE__*/Schema.Union([InputTextContent, OutputTextContent, TextContent, SummaryTextContent, ReasoningTextContent, RefusalContent, InputImageContent, ComputerScreenshotContent, InputFileContent]);
|
|
121
|
+
const OutputMessage = /*#__PURE__*/Schema.Struct({
|
|
122
|
+
id: Schema.String,
|
|
123
|
+
type: /*#__PURE__*/Schema.Literal("message"),
|
|
124
|
+
role: /*#__PURE__*/Schema.Literal("assistant"),
|
|
125
|
+
content: /*#__PURE__*/Schema.Array(OutputMessageContent),
|
|
126
|
+
status: MessageStatus
|
|
127
|
+
});
|
|
128
|
+
/**
|
|
129
|
+
* Schema for a reasoning output item containing encrypted content, summaries, and optional reasoning text.
|
|
130
|
+
*
|
|
131
|
+
* @category schemas
|
|
132
|
+
* @since 4.0.0
|
|
133
|
+
*/
|
|
134
|
+
export const ReasoningItem = /*#__PURE__*/Schema.Struct({
|
|
135
|
+
type: /*#__PURE__*/Schema.Literal("reasoning"),
|
|
136
|
+
id: Schema.String,
|
|
137
|
+
encrypted_content: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
|
|
138
|
+
summary: /*#__PURE__*/Schema.Array(SummaryTextContent),
|
|
139
|
+
content: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(ReasoningTextContent)),
|
|
140
|
+
status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
|
|
141
|
+
});
|
|
142
|
+
const FunctionCall = /*#__PURE__*/Schema.Struct({
|
|
143
|
+
id: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
144
|
+
type: /*#__PURE__*/Schema.Literal("function_call"),
|
|
145
|
+
call_id: Schema.String,
|
|
146
|
+
name: Schema.String,
|
|
147
|
+
arguments: Schema.String,
|
|
148
|
+
status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
|
|
149
|
+
});
|
|
150
|
+
const FunctionCallOutput = /*#__PURE__*/Schema.Struct({
|
|
151
|
+
id: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
|
|
152
|
+
type: /*#__PURE__*/Schema.Literal("function_call_output"),
|
|
153
|
+
call_id: Schema.String,
|
|
154
|
+
output: /*#__PURE__*/Schema.Union([Schema.String, /*#__PURE__*/Schema.Array(InputContent)]),
|
|
155
|
+
status: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(MessageStatus))
|
|
156
|
+
});
|
|
157
|
+
const ItemReference = /*#__PURE__*/Schema.Struct({
|
|
158
|
+
type: /*#__PURE__*/Schema.Literal("item_reference"),
|
|
159
|
+
id: Schema.String
|
|
160
|
+
});
|
|
161
|
+
const LocalShellCall = /*#__PURE__*/Schema.Struct({
|
|
162
|
+
id: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
163
|
+
type: /*#__PURE__*/Schema.Literal("local_shell_call"),
|
|
164
|
+
call_id: Schema.String,
|
|
165
|
+
action: Schema.Unknown,
|
|
166
|
+
status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
|
|
167
|
+
});
|
|
168
|
+
const LocalShellCallOutput = /*#__PURE__*/Schema.Struct({
|
|
169
|
+
id: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
170
|
+
type: /*#__PURE__*/Schema.Literal("local_shell_call_output"),
|
|
171
|
+
call_id: Schema.String,
|
|
172
|
+
output: Schema.Unknown,
|
|
173
|
+
status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
|
|
174
|
+
});
|
|
175
|
+
const ShellCall = /*#__PURE__*/Schema.Struct({
|
|
176
|
+
id: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
177
|
+
type: /*#__PURE__*/Schema.Literal("shell_call"),
|
|
178
|
+
call_id: Schema.String,
|
|
179
|
+
action: Schema.Unknown,
|
|
180
|
+
status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
|
|
181
|
+
});
|
|
182
|
+
const ShellCallOutput = /*#__PURE__*/Schema.Struct({
|
|
183
|
+
id: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
184
|
+
type: /*#__PURE__*/Schema.Literal("shell_call_output"),
|
|
185
|
+
call_id: Schema.String,
|
|
186
|
+
output: Schema.Unknown,
|
|
187
|
+
status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
|
|
188
|
+
});
|
|
189
|
+
const ApplyPatchCallOutput = /*#__PURE__*/Schema.Struct({
|
|
190
|
+
id: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
191
|
+
type: /*#__PURE__*/Schema.Literal("apply_patch_call_output"),
|
|
192
|
+
call_id: Schema.String,
|
|
193
|
+
status: /*#__PURE__*/Schema.optionalKey(MessageStatus),
|
|
194
|
+
output: /*#__PURE__*/Schema.optionalKey(Schema.Unknown)
|
|
195
|
+
});
|
|
196
|
+
const McpApprovalResponse = /*#__PURE__*/Schema.Struct({
|
|
197
|
+
type: /*#__PURE__*/Schema.Literal("mcp_approval_response"),
|
|
198
|
+
approval_request_id: Schema.String,
|
|
199
|
+
approve: Schema.Boolean
|
|
200
|
+
});
|
|
201
|
+
const RequestMessageItem = /*#__PURE__*/Schema.Struct({
|
|
202
|
+
type: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Literal("message")),
|
|
203
|
+
role: MessageRole,
|
|
204
|
+
status: /*#__PURE__*/Schema.optionalKey(MessageStatus),
|
|
205
|
+
content: /*#__PURE__*/Schema.Union([Schema.String, /*#__PURE__*/Schema.Array(InputContent)])
|
|
206
|
+
});
|
|
207
|
+
/**
|
|
208
|
+
* Schema for item shapes accepted by an OpenAI Responses request `input` field.
|
|
209
|
+
*
|
|
210
|
+
* @category schemas
|
|
211
|
+
* @since 4.0.0
|
|
212
|
+
*/
|
|
213
|
+
export const InputItem = /*#__PURE__*/Schema.Union([RequestMessageItem, OutputMessage, FunctionCall, FunctionCallOutput, ReasoningItem, ItemReference, LocalShellCall, LocalShellCallOutput, ShellCall, ShellCallOutput, ApplyPatchCallOutput, McpApprovalResponse]);
|
|
214
|
+
const FunctionTool = /*#__PURE__*/Schema.Struct({
|
|
215
|
+
type: /*#__PURE__*/Schema.Literal("function"),
|
|
216
|
+
name: Schema.String,
|
|
217
|
+
description: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
|
|
218
|
+
parameters: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(JsonObject)),
|
|
219
|
+
strict: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.Boolean))
|
|
220
|
+
});
|
|
221
|
+
const CustomTool = /*#__PURE__*/Schema.Struct({
|
|
222
|
+
type: /*#__PURE__*/Schema.Literal("custom"),
|
|
223
|
+
name: Schema.String,
|
|
224
|
+
description: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
225
|
+
format: /*#__PURE__*/Schema.optionalKey(Schema.Unknown)
|
|
226
|
+
});
|
|
227
|
+
const ProviderDefinedTool = /*#__PURE__*/Schema.StructWithRest(/*#__PURE__*/Schema.Struct({
|
|
228
|
+
type: /*#__PURE__*/Schema.Literals(["apply_patch", "code_interpreter", "file_search", "image_generation", "local_shell", "mcp", "shell", "web_search", "web_search_preview"])
|
|
229
|
+
}), [UnknownRecord]);
|
|
230
|
+
/**
|
|
231
|
+
* Schema for tool definitions that can be supplied to an OpenAI Responses request.
|
|
232
|
+
*
|
|
233
|
+
* @category schemas
|
|
234
|
+
* @since 4.0.0
|
|
235
|
+
*/
|
|
236
|
+
export const Tool = /*#__PURE__*/Schema.Union([FunctionTool, CustomTool, ProviderDefinedTool]);
|
|
237
|
+
/**
|
|
238
|
+
* Schema for selecting whether and which tools the model may call in a Responses request.
|
|
239
|
+
*
|
|
240
|
+
* @category schemas
|
|
241
|
+
* @since 4.0.0
|
|
242
|
+
*/
|
|
243
|
+
export const ToolChoice = /*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Literals(["none", "auto", "required"]), /*#__PURE__*/Schema.Struct({
|
|
244
|
+
type: /*#__PURE__*/Schema.Literal("allowed_tools"),
|
|
245
|
+
mode: /*#__PURE__*/Schema.Literals(["auto", "required"]),
|
|
246
|
+
tools: /*#__PURE__*/Schema.Array(JsonObject)
|
|
247
|
+
}), /*#__PURE__*/Schema.Struct({
|
|
248
|
+
type: /*#__PURE__*/Schema.Literal("function"),
|
|
249
|
+
name: Schema.String
|
|
250
|
+
}), /*#__PURE__*/Schema.Struct({
|
|
251
|
+
type: /*#__PURE__*/Schema.Literal("custom"),
|
|
252
|
+
name: Schema.String
|
|
253
|
+
}), /*#__PURE__*/Schema.StructWithRest(/*#__PURE__*/Schema.Struct({
|
|
254
|
+
type: /*#__PURE__*/Schema.Literals(["apply_patch", "code_interpreter", "file_search", "image_generation", "local_shell", "mcp", "shell", "web_search", "web_search_preview"])
|
|
255
|
+
}), [UnknownRecord])]);
|
|
256
|
+
/**
|
|
257
|
+
* Schema for text output format configuration, including plain text, JSON object, and JSON Schema responses.
|
|
258
|
+
*
|
|
259
|
+
* @category schemas
|
|
260
|
+
* @since 4.0.0
|
|
261
|
+
*/
|
|
262
|
+
export const TextResponseFormatConfiguration = /*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Struct({
|
|
263
|
+
type: /*#__PURE__*/Schema.Literal("text")
|
|
264
|
+
}), /*#__PURE__*/Schema.Struct({
|
|
265
|
+
type: /*#__PURE__*/Schema.Literal("json_schema"),
|
|
266
|
+
description: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
267
|
+
name: Schema.String,
|
|
268
|
+
schema: JsonObject,
|
|
269
|
+
strict: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.Boolean))
|
|
270
|
+
}), /*#__PURE__*/Schema.Struct({
|
|
271
|
+
type: /*#__PURE__*/Schema.Literal("json_object")
|
|
272
|
+
})]);
|
|
273
|
+
/**
|
|
274
|
+
* Schema for request options used to create an OpenAI Responses API response.
|
|
275
|
+
*
|
|
276
|
+
* @category schemas
|
|
277
|
+
* @since 4.0.0
|
|
278
|
+
*/
|
|
279
|
+
export const CreateResponse = /*#__PURE__*/Schema.Struct({
|
|
280
|
+
metadata: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record(Schema.String, Schema.String)),
|
|
281
|
+
top_logprobs: /*#__PURE__*/Schema.optional(Schema.Number),
|
|
282
|
+
temperature: /*#__PURE__*/Schema.optional(Schema.Number),
|
|
283
|
+
top_p: /*#__PURE__*/Schema.optional(Schema.Number),
|
|
284
|
+
user: /*#__PURE__*/Schema.optional(Schema.String),
|
|
285
|
+
service_tier: /*#__PURE__*/Schema.optional(Schema.String),
|
|
286
|
+
previous_response_id: /*#__PURE__*/Schema.optional(Schema.String),
|
|
287
|
+
model: /*#__PURE__*/Schema.optional(Schema.String),
|
|
288
|
+
reasoning: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Struct({
|
|
289
|
+
effort: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literals(["none", "minimal", "low", "medium", "high", "xhigh"])),
|
|
290
|
+
summary: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literals(["auto", "concise", "detailed"])),
|
|
291
|
+
generate_summary: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literals(["auto", "concise", "detailed"]))
|
|
292
|
+
})),
|
|
293
|
+
background: /*#__PURE__*/Schema.optional(Schema.Boolean),
|
|
294
|
+
max_output_tokens: /*#__PURE__*/Schema.optional(Schema.Number),
|
|
295
|
+
max_tool_calls: /*#__PURE__*/Schema.optional(Schema.Number),
|
|
296
|
+
text: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Struct({
|
|
297
|
+
format: /*#__PURE__*/Schema.optional(TextResponseFormatConfiguration),
|
|
298
|
+
verbosity: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literals(["low", "medium", "high"]))
|
|
299
|
+
})),
|
|
300
|
+
tools: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(Tool)),
|
|
301
|
+
tool_choice: /*#__PURE__*/Schema.optional(ToolChoice),
|
|
302
|
+
truncation: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literals(["auto", "disabled"])),
|
|
303
|
+
input: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Union([Schema.String, /*#__PURE__*/Schema.Array(InputItem)])),
|
|
304
|
+
include: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(IncludeEnum)),
|
|
305
|
+
store: /*#__PURE__*/Schema.optional(Schema.Boolean),
|
|
306
|
+
instructions: /*#__PURE__*/Schema.optional(Schema.String),
|
|
307
|
+
stream: /*#__PURE__*/Schema.optional(Schema.Boolean),
|
|
308
|
+
conversation: /*#__PURE__*/Schema.optional(Schema.String),
|
|
309
|
+
modalities: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(/*#__PURE__*/Schema.Literals(["text", "audio"]))),
|
|
310
|
+
seed: /*#__PURE__*/Schema.optional(Schema.Number)
|
|
311
|
+
});
|
|
312
|
+
/**
|
|
313
|
+
* Schema for token accounting reported on OpenAI Responses API response objects.
|
|
314
|
+
*
|
|
315
|
+
* @category schemas
|
|
316
|
+
* @since 4.0.0
|
|
317
|
+
*/
|
|
318
|
+
export const ResponseUsage = /*#__PURE__*/Schema.StructWithRest(/*#__PURE__*/Schema.Struct({
|
|
319
|
+
input_tokens: Schema.Number,
|
|
320
|
+
output_tokens: Schema.Number,
|
|
321
|
+
total_tokens: Schema.Number,
|
|
322
|
+
input_tokens_details: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
|
|
323
|
+
output_tokens_details: /*#__PURE__*/Schema.optionalKey(Schema.Unknown)
|
|
324
|
+
}), [UnknownRecord]);
|
|
325
|
+
const ApplyPatchOperation = /*#__PURE__*/Schema.Struct({
|
|
326
|
+
type: Schema.String,
|
|
327
|
+
path: Schema.String,
|
|
328
|
+
diff: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
329
|
+
});
|
|
330
|
+
const ApplyPatchCall = /*#__PURE__*/Schema.Struct({
|
|
331
|
+
id: Schema.String,
|
|
332
|
+
type: /*#__PURE__*/Schema.Literal("apply_patch_call"),
|
|
333
|
+
call_id: Schema.String,
|
|
334
|
+
operation: ApplyPatchOperation,
|
|
335
|
+
status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
|
|
336
|
+
});
|
|
337
|
+
const CodeInterpreterCall = /*#__PURE__*/Schema.Struct({
|
|
338
|
+
id: Schema.String,
|
|
339
|
+
type: /*#__PURE__*/Schema.Literal("code_interpreter_call"),
|
|
340
|
+
code: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
341
|
+
container_id: Schema.String,
|
|
342
|
+
outputs: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(Schema.Unknown)),
|
|
343
|
+
status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
|
|
344
|
+
});
|
|
345
|
+
const ComputerCall = /*#__PURE__*/Schema.Struct({
|
|
346
|
+
id: Schema.String,
|
|
347
|
+
type: /*#__PURE__*/Schema.Literal("computer_call"),
|
|
348
|
+
status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
|
|
349
|
+
});
|
|
350
|
+
const FileSearchCall = /*#__PURE__*/Schema.Struct({
|
|
351
|
+
id: Schema.String,
|
|
352
|
+
type: /*#__PURE__*/Schema.Literal("file_search_call"),
|
|
353
|
+
status: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
354
|
+
queries: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(Schema.String)),
|
|
355
|
+
results: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.Unknown))
|
|
356
|
+
});
|
|
357
|
+
const ImageGenerationCall = /*#__PURE__*/Schema.Struct({
|
|
358
|
+
id: Schema.String,
|
|
359
|
+
type: /*#__PURE__*/Schema.Literal("image_generation_call"),
|
|
360
|
+
result: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
361
|
+
status: /*#__PURE__*/Schema.optionalKey(MessageStatus)
|
|
362
|
+
});
|
|
363
|
+
const McpCall = /*#__PURE__*/Schema.Struct({
|
|
364
|
+
id: Schema.String,
|
|
365
|
+
type: /*#__PURE__*/Schema.Literal("mcp_call"),
|
|
366
|
+
approval_request_id: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String)),
|
|
367
|
+
name: Schema.String,
|
|
368
|
+
arguments: Schema.Unknown,
|
|
369
|
+
output: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
|
|
370
|
+
error: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
|
|
371
|
+
server_label: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(Schema.String))
|
|
372
|
+
});
|
|
373
|
+
const McpListTools = /*#__PURE__*/Schema.Struct({
|
|
374
|
+
id: Schema.String,
|
|
375
|
+
type: /*#__PURE__*/Schema.Literal("mcp_list_tools")
|
|
376
|
+
});
|
|
377
|
+
const McpApprovalRequest = /*#__PURE__*/Schema.Struct({
|
|
378
|
+
id: Schema.String,
|
|
379
|
+
type: /*#__PURE__*/Schema.Literal("mcp_approval_request"),
|
|
380
|
+
approval_request_id: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
381
|
+
name: Schema.String,
|
|
382
|
+
arguments: Schema.Unknown
|
|
383
|
+
});
|
|
384
|
+
const WebSearchCall = /*#__PURE__*/Schema.Struct({
|
|
385
|
+
id: Schema.String,
|
|
386
|
+
type: /*#__PURE__*/Schema.Literal("web_search_call"),
|
|
387
|
+
action: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
|
|
388
|
+
status: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
389
|
+
});
|
|
390
|
+
const OutputItem = /*#__PURE__*/Schema.Union([ApplyPatchCall, CodeInterpreterCall, ComputerCall, FileSearchCall, FunctionCall, ImageGenerationCall, LocalShellCall, McpCall, McpListTools, McpApprovalRequest, OutputMessage, ReasoningItem, ShellCall, WebSearchCall]);
|
|
391
|
+
/**
|
|
392
|
+
* Schema for an OpenAI Responses API response object.
|
|
393
|
+
*
|
|
394
|
+
* @category schemas
|
|
395
|
+
* @since 4.0.0
|
|
396
|
+
*/
|
|
397
|
+
export const Response = /*#__PURE__*/Schema.Struct({
|
|
398
|
+
id: Schema.String,
|
|
399
|
+
object: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Literal("response")),
|
|
400
|
+
model: Schema.String,
|
|
401
|
+
created_at: Schema.Number,
|
|
402
|
+
output: /*#__PURE__*/Schema.Array(OutputItem),
|
|
403
|
+
usage: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(ResponseUsage)),
|
|
404
|
+
incomplete_details: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.NullOr(/*#__PURE__*/Schema.Struct({
|
|
405
|
+
reason: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Literals(["max_output_tokens", "content_filter"]))
|
|
406
|
+
}))),
|
|
407
|
+
service_tier: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
408
|
+
});
|
|
409
|
+
const ResponseCreatedEvent = /*#__PURE__*/Schema.Struct({
|
|
410
|
+
type: /*#__PURE__*/Schema.Literal("response.created"),
|
|
411
|
+
response: Response,
|
|
412
|
+
sequence_number: Schema.Number
|
|
413
|
+
});
|
|
414
|
+
const ResponseCompletedEvent = /*#__PURE__*/Schema.Struct({
|
|
415
|
+
type: /*#__PURE__*/Schema.Literal("response.completed"),
|
|
416
|
+
response: Response,
|
|
417
|
+
sequence_number: Schema.Number
|
|
418
|
+
});
|
|
419
|
+
const ResponseIncompleteEvent = /*#__PURE__*/Schema.Struct({
|
|
420
|
+
type: /*#__PURE__*/Schema.Literal("response.incomplete"),
|
|
421
|
+
response: Response,
|
|
422
|
+
sequence_number: Schema.Number
|
|
423
|
+
});
|
|
424
|
+
const ResponseFailedEvent = /*#__PURE__*/Schema.Struct({
|
|
425
|
+
type: /*#__PURE__*/Schema.Literal("response.failed"),
|
|
426
|
+
response: Response,
|
|
427
|
+
sequence_number: Schema.Number
|
|
428
|
+
});
|
|
429
|
+
const ResponseOutputItemAddedEvent = /*#__PURE__*/Schema.Struct({
|
|
430
|
+
type: /*#__PURE__*/Schema.Literal("response.output_item.added"),
|
|
431
|
+
output_index: Schema.Number,
|
|
432
|
+
sequence_number: Schema.Number,
|
|
433
|
+
item: OutputItem
|
|
434
|
+
});
|
|
435
|
+
const ResponseOutputItemDoneEvent = /*#__PURE__*/Schema.Struct({
|
|
436
|
+
type: /*#__PURE__*/Schema.Literal("response.output_item.done"),
|
|
437
|
+
output_index: Schema.Number,
|
|
438
|
+
sequence_number: Schema.Number,
|
|
439
|
+
item: OutputItem
|
|
440
|
+
});
|
|
441
|
+
const ResponseOutputTextDeltaEvent = /*#__PURE__*/Schema.Struct({
|
|
442
|
+
type: /*#__PURE__*/Schema.Literal("response.output_text.delta"),
|
|
443
|
+
item_id: Schema.String,
|
|
444
|
+
output_index: Schema.Number,
|
|
445
|
+
content_index: Schema.Number,
|
|
446
|
+
delta: Schema.String,
|
|
447
|
+
sequence_number: Schema.Number,
|
|
448
|
+
logprobs: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(Schema.Unknown))
|
|
449
|
+
});
|
|
450
|
+
const ResponseOutputTextAnnotationAddedEvent = /*#__PURE__*/Schema.Struct({
|
|
451
|
+
type: /*#__PURE__*/Schema.Literal("response.output_text.annotation.added"),
|
|
452
|
+
item_id: Schema.String,
|
|
453
|
+
output_index: Schema.Number,
|
|
454
|
+
content_index: Schema.Number,
|
|
455
|
+
annotation_index: Schema.Number,
|
|
456
|
+
sequence_number: Schema.Number,
|
|
457
|
+
annotation: Annotation
|
|
458
|
+
});
|
|
459
|
+
const ResponseReasoningSummaryPartAddedEvent = /*#__PURE__*/Schema.Struct({
|
|
460
|
+
type: /*#__PURE__*/Schema.Literal("response.reasoning_summary_part.added"),
|
|
461
|
+
item_id: Schema.String,
|
|
462
|
+
output_index: Schema.Number,
|
|
463
|
+
summary_index: Schema.Number,
|
|
464
|
+
sequence_number: Schema.Number,
|
|
465
|
+
part: SummaryTextContent
|
|
466
|
+
});
|
|
467
|
+
const ResponseReasoningSummaryPartDoneEvent = /*#__PURE__*/Schema.Struct({
|
|
468
|
+
type: /*#__PURE__*/Schema.Literal("response.reasoning_summary_part.done"),
|
|
469
|
+
item_id: Schema.String,
|
|
470
|
+
output_index: Schema.Number,
|
|
471
|
+
summary_index: Schema.Number,
|
|
472
|
+
sequence_number: Schema.Number,
|
|
473
|
+
part: SummaryTextContent
|
|
474
|
+
});
|
|
475
|
+
const ResponseReasoningSummaryTextDeltaEvent = /*#__PURE__*/Schema.Struct({
|
|
476
|
+
type: /*#__PURE__*/Schema.Literal("response.reasoning_summary_text.delta"),
|
|
477
|
+
item_id: Schema.String,
|
|
478
|
+
output_index: Schema.Number,
|
|
479
|
+
summary_index: Schema.Number,
|
|
480
|
+
delta: Schema.String,
|
|
481
|
+
sequence_number: Schema.Number
|
|
482
|
+
});
|
|
483
|
+
const ResponseFunctionCallArgumentsDeltaEvent = /*#__PURE__*/Schema.Struct({
|
|
484
|
+
type: /*#__PURE__*/Schema.Literal("response.function_call_arguments.delta"),
|
|
485
|
+
item_id: Schema.String,
|
|
486
|
+
output_index: Schema.Number,
|
|
487
|
+
sequence_number: Schema.Number,
|
|
488
|
+
delta: Schema.String
|
|
489
|
+
});
|
|
490
|
+
const ResponseFunctionCallArgumentsDoneEvent = /*#__PURE__*/Schema.Struct({
|
|
491
|
+
type: /*#__PURE__*/Schema.Literal("response.function_call_arguments.done"),
|
|
492
|
+
item_id: Schema.String,
|
|
493
|
+
output_index: Schema.Number,
|
|
494
|
+
sequence_number: Schema.Number,
|
|
495
|
+
arguments: Schema.String
|
|
496
|
+
});
|
|
497
|
+
const ResponseCodeInterpreterCallCodeDeltaEvent = /*#__PURE__*/Schema.Struct({
|
|
498
|
+
type: /*#__PURE__*/Schema.Literal("response.code_interpreter_call_code.delta"),
|
|
499
|
+
item_id: Schema.String,
|
|
500
|
+
output_index: Schema.Number,
|
|
501
|
+
sequence_number: Schema.Number,
|
|
502
|
+
delta: Schema.String
|
|
503
|
+
});
|
|
504
|
+
const ResponseCodeInterpreterCallCodeDoneEvent = /*#__PURE__*/Schema.Struct({
|
|
505
|
+
type: /*#__PURE__*/Schema.Literal("response.code_interpreter_call_code.done"),
|
|
506
|
+
item_id: Schema.String,
|
|
507
|
+
output_index: Schema.Number,
|
|
508
|
+
sequence_number: Schema.Number,
|
|
509
|
+
code: Schema.String
|
|
510
|
+
});
|
|
511
|
+
const ResponseApplyPatchCallOperationDiffDeltaEvent = /*#__PURE__*/Schema.Struct({
|
|
512
|
+
type: /*#__PURE__*/Schema.Literal("response.apply_patch_call_operation_diff.delta"),
|
|
513
|
+
item_id: Schema.String,
|
|
514
|
+
output_index: Schema.Number,
|
|
515
|
+
sequence_number: Schema.Number,
|
|
516
|
+
delta: Schema.String
|
|
517
|
+
});
|
|
518
|
+
const ResponseApplyPatchCallOperationDiffDoneEvent = /*#__PURE__*/Schema.Struct({
|
|
519
|
+
type: /*#__PURE__*/Schema.Literal("response.apply_patch_call_operation_diff.done"),
|
|
520
|
+
item_id: Schema.String,
|
|
521
|
+
output_index: Schema.Number,
|
|
522
|
+
sequence_number: Schema.Number,
|
|
523
|
+
delta: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
524
|
+
});
|
|
525
|
+
const ResponseImageGenerationCallPartialImageEvent = /*#__PURE__*/Schema.Struct({
|
|
526
|
+
type: /*#__PURE__*/Schema.Literal("response.image_generation_call.partial_image"),
|
|
527
|
+
item_id: Schema.String,
|
|
528
|
+
output_index: Schema.Number,
|
|
529
|
+
sequence_number: Schema.Number,
|
|
530
|
+
partial_image_b64: Schema.String
|
|
531
|
+
});
|
|
532
|
+
const ResponseErrorEvent = /*#__PURE__*/Schema.Struct({
|
|
533
|
+
type: /*#__PURE__*/Schema.Literal("error"),
|
|
534
|
+
code: /*#__PURE__*/Schema.NullOr(Schema.String),
|
|
535
|
+
message: Schema.String,
|
|
536
|
+
param: /*#__PURE__*/Schema.NullOr(Schema.String),
|
|
537
|
+
sequence_number: Schema.Number,
|
|
538
|
+
status: /*#__PURE__*/Schema.optionalKey(Schema.Number)
|
|
539
|
+
});
|
|
540
|
+
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"]);
|
|
541
|
+
const UnknownResponseStreamEvent = /*#__PURE__*/Schema.declare(value => Predicate.hasProperty(value, "type") && typeof value.type === "string" && !knownResponseStreamEventTypes.has(value.type), {
|
|
542
|
+
identifier: "UnknownResponseStreamEvent",
|
|
543
|
+
description: "Fallback for unknown future stream events"
|
|
544
|
+
});
|
|
545
|
+
/**
|
|
546
|
+
* Schema for server-sent event shapes emitted by OpenAI Responses API streams.
|
|
547
|
+
*
|
|
548
|
+
* @category schemas
|
|
549
|
+
* @since 4.0.0
|
|
550
|
+
*/
|
|
551
|
+
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]);
|
|
552
|
+
/**
|
|
553
|
+
* Schema for one embedding item returned by the OpenAI embeddings API.
|
|
554
|
+
*
|
|
555
|
+
* @category schemas
|
|
556
|
+
* @since 4.0.0
|
|
557
|
+
*/
|
|
558
|
+
export const Embedding = /*#__PURE__*/Schema.Struct({
|
|
559
|
+
embedding: /*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Array(Schema.Number), Schema.String]),
|
|
560
|
+
index: Schema.Number,
|
|
561
|
+
object: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
562
|
+
});
|
|
563
|
+
/**
|
|
564
|
+
* Schema for the request payload sent to the OpenAI embeddings endpoint.
|
|
565
|
+
*
|
|
566
|
+
* @category schemas
|
|
567
|
+
* @since 4.0.0
|
|
568
|
+
*/
|
|
569
|
+
export const CreateEmbeddingRequest = /*#__PURE__*/Schema.Struct({
|
|
570
|
+
input: /*#__PURE__*/Schema.Union([Schema.String, /*#__PURE__*/Schema.Array(Schema.String), /*#__PURE__*/Schema.Array(Schema.Number), /*#__PURE__*/Schema.Array(/*#__PURE__*/Schema.Array(Schema.Number))]),
|
|
571
|
+
model: Schema.String,
|
|
572
|
+
encoding_format: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Literals(["float", "base64"])),
|
|
573
|
+
dimensions: /*#__PURE__*/Schema.optionalKey(Schema.Number),
|
|
574
|
+
user: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
575
|
+
});
|
|
576
|
+
/**
|
|
577
|
+
* Schema for a successful response payload returned by the OpenAI embeddings endpoint.
|
|
578
|
+
*
|
|
579
|
+
* @category schemas
|
|
580
|
+
* @since 4.0.0
|
|
581
|
+
*/
|
|
582
|
+
export const CreateEmbeddingResponse = /*#__PURE__*/Schema.Struct({
|
|
583
|
+
data: /*#__PURE__*/Schema.Array(Embedding),
|
|
584
|
+
model: Schema.String,
|
|
585
|
+
object: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Literal("list")),
|
|
586
|
+
usage: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Struct({
|
|
587
|
+
prompt_tokens: Schema.Number,
|
|
588
|
+
total_tokens: Schema.Number
|
|
589
|
+
}))
|
|
590
|
+
});
|
|
591
|
+
//# sourceMappingURL=OpenAiSchema.js.map
|