@effect/ai-openai 4.0.0-beta.1 → 4.0.0-beta.100
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 +68897 -39886
- 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 +170 -29
- package/dist/OpenAiClient.d.ts.map +1 -1
- package/dist/OpenAiClient.js +321 -46
- 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 +88 -10
- package/dist/OpenAiConfig.d.ts.map +1 -1
- package/dist/OpenAiConfig.js +42 -7
- package/dist/OpenAiConfig.js.map +1 -1
- package/dist/OpenAiEmbeddingModel.d.ts +188 -0
- package/dist/OpenAiEmbeddingModel.d.ts.map +1 -0
- package/dist/OpenAiEmbeddingModel.js +194 -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 +360 -72
- package/dist/OpenAiLanguageModel.d.ts.map +1 -1
- package/dist/OpenAiLanguageModel.js +393 -171
- package/dist/OpenAiLanguageModel.js.map +1 -1
- package/dist/OpenAiSchema.d.ts +2325 -0
- package/dist/OpenAiSchema.d.ts.map +1 -0
- package/dist/OpenAiSchema.js +811 -0
- package/dist/OpenAiSchema.js.map +1 -0
- package/dist/OpenAiTelemetry.d.ts +63 -22
- package/dist/OpenAiTelemetry.d.ts.map +1 -1
- package/dist/OpenAiTelemetry.js +20 -10
- package/dist/OpenAiTelemetry.js.map +1 -1
- package/dist/OpenAiTool.d.ts +199 -109
- package/dist/OpenAiTool.d.ts.map +1 -1
- package/dist/OpenAiTool.js +125 -39
- package/dist/OpenAiTool.js.map +1 -1
- package/dist/index.d.ts +19 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -33
- package/dist/index.js.map +1 -1
- package/dist/internal/errors.js +4 -4
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/utilities.js +0 -4
- package/dist/internal/utilities.js.map +1 -1
- package/package.json +5 -6
- package/src/Generated.ts +9897 -5083
- package/src/OpenAiClient.ts +499 -98
- package/src/OpenAiClientGenerated.ts +202 -0
- package/src/OpenAiConfig.ts +89 -11
- package/src/OpenAiEmbeddingModel.ts +332 -0
- package/src/OpenAiError.ts +170 -35
- package/src/OpenAiLanguageModel.ts +779 -172
- package/src/OpenAiSchema.ts +1286 -0
- package/src/OpenAiTelemetry.ts +69 -28
- package/src/OpenAiTool.ts +126 -40
- package/src/index.ts +22 -33
- package/src/internal/errors.ts +6 -4
- package/src/internal/utilities.ts +0 -6
package/dist/OpenAiTool.d.ts
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OpenAI provider
|
|
2
|
+
* The `OpenAiTool` module defines OpenAI provider tools for Effect AI language
|
|
3
|
+
* model requests. It exposes typed descriptors for tools such as Apply Patch,
|
|
4
|
+
* Code Interpreter, File Search, Image Generation, MCP, Web Search, and
|
|
5
|
+
* shell-like local tools, including their provider names, configuration
|
|
6
|
+
* arguments, call parameters, success schemas, and handler requirements.
|
|
3
7
|
*
|
|
4
|
-
*
|
|
5
|
-
* code interpreter, file search, and web search functionality.
|
|
6
|
-
*
|
|
7
|
-
* @since 1.0.0
|
|
8
|
+
* @since 4.0.0
|
|
8
9
|
*/
|
|
9
10
|
import * as Schema from "effect/Schema";
|
|
10
11
|
import * as Tool from "effect/unstable/ai/Tool";
|
|
11
12
|
/**
|
|
12
13
|
* Union of all OpenAI provider-defined tools.
|
|
13
14
|
*
|
|
14
|
-
* @since 1.0.0
|
|
15
15
|
* @category models
|
|
16
|
+
* @since 4.0.0
|
|
16
17
|
*/
|
|
17
18
|
export type OpenAiTool = ReturnType<typeof ApplyPatch> | ReturnType<typeof CodeInterpreter> | ReturnType<typeof FileSearch> | ReturnType<typeof Shell> | ReturnType<typeof ImageGeneration> | ReturnType<typeof LocalShell> | ReturnType<typeof Mcp> | ReturnType<typeof WebSearch> | ReturnType<typeof WebSearchPreview>;
|
|
18
19
|
/**
|
|
19
|
-
* OpenAI Apply Patch tool
|
|
20
|
+
* Defines the OpenAI Apply Patch tool that allows the model to apply diffs by creating,
|
|
21
|
+
* deleting, or updating files. This local tool runs in your environment and
|
|
22
|
+
* requires a handler to execute file operations.
|
|
23
|
+
*
|
|
24
|
+
* **When to use**
|
|
20
25
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
26
|
+
* Use when you want an OpenAI model to request structured file edits as create,
|
|
27
|
+
* delete, or update operations that your application executes through a local
|
|
28
|
+
* handler.
|
|
24
29
|
*
|
|
25
|
-
* @since 1.0.0
|
|
26
30
|
* @category tools
|
|
31
|
+
* @since 4.0.0
|
|
27
32
|
*/
|
|
28
33
|
export declare const ApplyPatch: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
29
34
|
readonly failureMode?: Mode | undefined;
|
|
@@ -52,42 +57,51 @@ export declare const ApplyPatch: <Mode extends Tool.FailureMode | undefined = un
|
|
|
52
57
|
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
53
58
|
}, true>;
|
|
54
59
|
/**
|
|
55
|
-
* OpenAI Code Interpreter tool
|
|
60
|
+
* Defines the OpenAI Code Interpreter tool that allows the model to execute Python code in
|
|
61
|
+
* a sandboxed environment.
|
|
62
|
+
*
|
|
63
|
+
* **When to use**
|
|
64
|
+
*
|
|
65
|
+
* Use to enable OpenAI-hosted Python execution for a model response.
|
|
56
66
|
*
|
|
57
|
-
*
|
|
67
|
+
* **Details**
|
|
68
|
+
*
|
|
69
|
+
* The tool is configured with a `container` argument. Successful tool calls
|
|
70
|
+
* expose `outputs`, which may contain logs or generated images, or `null` when
|
|
71
|
+
* no outputs are available.
|
|
58
72
|
*
|
|
59
|
-
* @since 1.0.0
|
|
60
73
|
* @category tools
|
|
74
|
+
* @since 4.0.0
|
|
61
75
|
*/
|
|
62
76
|
export declare const CodeInterpreter: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
63
77
|
readonly container: string | {
|
|
64
78
|
readonly type: "auto";
|
|
65
|
-
readonly
|
|
66
|
-
readonly
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
readonly file_ids?: readonly string[];
|
|
80
|
+
readonly memory_limit?: "16g" | "1g" | "4g" | "64g" | null;
|
|
81
|
+
readonly network_policy?: Schema.Struct.ReadonlySide<{
|
|
82
|
+
readonly type: Schema.Literal<"disabled">;
|
|
83
|
+
}, "Encoded"> | {
|
|
69
84
|
readonly type: "allowlist";
|
|
70
85
|
readonly allowed_domains: readonly string[];
|
|
71
|
-
readonly domain_secrets?: readonly {
|
|
72
|
-
readonly
|
|
73
|
-
readonly name:
|
|
74
|
-
readonly
|
|
75
|
-
}[];
|
|
86
|
+
readonly domain_secrets?: readonly Schema.Struct.ReadonlySide<{
|
|
87
|
+
readonly domain: Schema.String;
|
|
88
|
+
readonly name: Schema.String;
|
|
89
|
+
readonly value: Schema.String;
|
|
90
|
+
}, "Encoded">[];
|
|
76
91
|
};
|
|
77
|
-
readonly file_ids?: readonly string[];
|
|
78
92
|
};
|
|
79
93
|
}) => Tool.ProviderDefined<"openai.code_interpreter", "OpenAiCodeInterpreter", {
|
|
80
94
|
readonly args: Schema.Struct<{
|
|
81
95
|
readonly container: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
82
96
|
readonly type: Schema.Literal<"auto">;
|
|
83
|
-
readonly file_ids: Schema.optionalKey<Schema
|
|
97
|
+
readonly file_ids: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
84
98
|
readonly memory_limit: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["1g", "4g", "16g", "64g"]>, Schema.Null]>>;
|
|
85
99
|
readonly network_policy: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
86
100
|
readonly type: Schema.Literal<"disabled">;
|
|
87
101
|
}>, Schema.Struct<{
|
|
88
102
|
readonly type: Schema.Literal<"allowlist">;
|
|
89
|
-
readonly allowed_domains: Schema
|
|
90
|
-
readonly domain_secrets: Schema.optionalKey<Schema
|
|
103
|
+
readonly allowed_domains: Schema.$Array<Schema.String>;
|
|
104
|
+
readonly domain_secrets: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
91
105
|
readonly domain: Schema.String;
|
|
92
106
|
readonly name: Schema.String;
|
|
93
107
|
readonly value: Schema.String;
|
|
@@ -100,7 +114,7 @@ export declare const CodeInterpreter: <Mode extends Tool.FailureMode | undefined
|
|
|
100
114
|
readonly container_id: Schema.String;
|
|
101
115
|
}>;
|
|
102
116
|
readonly success: Schema.Struct<{
|
|
103
|
-
readonly outputs: Schema.Union<readonly [Schema
|
|
117
|
+
readonly outputs: Schema.Union<readonly [Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
104
118
|
readonly type: Schema.Literal<"logs">;
|
|
105
119
|
readonly logs: Schema.String;
|
|
106
120
|
}>, Schema.Struct<{
|
|
@@ -112,44 +126,58 @@ export declare const CodeInterpreter: <Mode extends Tool.FailureMode | undefined
|
|
|
112
126
|
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
113
127
|
}, false>;
|
|
114
128
|
/**
|
|
115
|
-
* OpenAI File Search tool
|
|
129
|
+
* Defines the OpenAI File Search tool that enables the model to search through uploaded
|
|
130
|
+
* files and vector stores.
|
|
131
|
+
*
|
|
132
|
+
* **When to use**
|
|
116
133
|
*
|
|
117
|
-
*
|
|
134
|
+
* Use to let an OpenAI model search uploaded files through one or more vector
|
|
135
|
+
* stores.
|
|
136
|
+
*
|
|
137
|
+
* **Details**
|
|
138
|
+
*
|
|
139
|
+
* The tool requires `vector_store_ids` and accepts optional `filters`,
|
|
140
|
+
* `max_num_results`, and `ranking_options`. Successful tool calls expose the
|
|
141
|
+
* search `status`, generated `queries`, and optional `results`.
|
|
118
142
|
*
|
|
119
|
-
* @since 1.0.0
|
|
120
143
|
* @category tools
|
|
144
|
+
* @since 4.0.0
|
|
121
145
|
*/
|
|
122
146
|
export declare const FileSearch: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
123
|
-
readonly
|
|
124
|
-
|
|
125
|
-
readonly
|
|
126
|
-
readonly
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
readonly
|
|
130
|
-
|
|
131
|
-
|
|
147
|
+
readonly filters?: Schema.Struct.ReadonlySide<{
|
|
148
|
+
readonly type: Schema.Literals<readonly ["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]>;
|
|
149
|
+
readonly key: Schema.String;
|
|
150
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>]>;
|
|
151
|
+
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
152
|
+
readonly type: Schema.Literals<readonly ["and", "or"]>;
|
|
153
|
+
readonly filters: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
154
|
+
readonly type: Schema.Literals<readonly ["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]>;
|
|
155
|
+
readonly key: Schema.String;
|
|
156
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>]>;
|
|
157
|
+
}>, Schema.Unknown]>>;
|
|
158
|
+
}, "Encoded"> | null;
|
|
132
159
|
readonly max_num_results?: number;
|
|
133
160
|
readonly ranking_options?: {
|
|
134
161
|
readonly ranker?: "auto" | "default-2024-11-15";
|
|
135
162
|
readonly score_threshold?: number;
|
|
136
|
-
readonly hybrid_search?: {
|
|
137
|
-
readonly embedding_weight:
|
|
138
|
-
readonly text_weight:
|
|
139
|
-
}
|
|
163
|
+
readonly hybrid_search?: Schema.Struct.ReadonlySide<{
|
|
164
|
+
readonly embedding_weight: Schema.Number;
|
|
165
|
+
readonly text_weight: Schema.Number;
|
|
166
|
+
}, "Encoded">;
|
|
140
167
|
};
|
|
168
|
+
readonly vector_store_ids: readonly string[];
|
|
141
169
|
}) => Tool.ProviderDefined<"openai.file_search", "OpenAiFileSearch", {
|
|
142
170
|
readonly args: Schema.Struct<{
|
|
143
171
|
readonly filters: Schema.optionalKey<Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
144
|
-
readonly type: Schema.Literals<readonly ["eq", "ne", "gt", "gte", "lt", "lte"]>;
|
|
172
|
+
readonly type: Schema.Literals<readonly ["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]>;
|
|
145
173
|
readonly key: Schema.String;
|
|
146
|
-
readonly value: Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema
|
|
174
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>]>;
|
|
147
175
|
}>, Schema.Struct<{
|
|
148
176
|
readonly type: Schema.Literals<readonly ["and", "or"]>;
|
|
149
|
-
readonly filters: Schema
|
|
150
|
-
readonly type: Schema.Literals<readonly ["eq", "ne", "gt", "gte", "lt", "lte"]>;
|
|
177
|
+
readonly filters: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
178
|
+
readonly type: Schema.Literals<readonly ["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]>;
|
|
151
179
|
readonly key: Schema.String;
|
|
152
|
-
readonly value: Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema
|
|
180
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>]>;
|
|
153
181
|
}>, Schema.Unknown]>>;
|
|
154
182
|
}>]>, Schema.Null]>>;
|
|
155
183
|
readonly max_num_results: Schema.optionalKey<Schema.Number>;
|
|
@@ -161,13 +189,13 @@ export declare const FileSearch: <Mode extends Tool.FailureMode | undefined = un
|
|
|
161
189
|
readonly text_weight: Schema.Number;
|
|
162
190
|
}>>;
|
|
163
191
|
}>>;
|
|
164
|
-
readonly vector_store_ids: Schema
|
|
192
|
+
readonly vector_store_ids: Schema.$Array<Schema.String>;
|
|
165
193
|
}>;
|
|
166
194
|
readonly parameters: Schema.Void;
|
|
167
195
|
readonly success: Schema.Struct<{
|
|
168
196
|
readonly status: Schema.Literals<readonly ["in_progress", "searching", "completed", "incomplete", "failed"]>;
|
|
169
|
-
readonly queries: Schema
|
|
170
|
-
readonly results: Schema.optionalKey<Schema.Union<readonly [Schema
|
|
197
|
+
readonly queries: Schema.$Array<Schema.String>;
|
|
198
|
+
readonly results: Schema.optionalKey<Schema.Union<readonly [Schema.$Array<Schema.Struct<{
|
|
171
199
|
readonly file_id: Schema.optionalKey<Schema.String>;
|
|
172
200
|
readonly text: Schema.optionalKey<Schema.String>;
|
|
173
201
|
readonly filename: Schema.optionalKey<Schema.String>;
|
|
@@ -179,27 +207,38 @@ export declare const FileSearch: <Mode extends Tool.FailureMode | undefined = un
|
|
|
179
207
|
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
180
208
|
}, false>;
|
|
181
209
|
/**
|
|
182
|
-
* OpenAI Image Generation tool
|
|
210
|
+
* Defines the OpenAI Image Generation tool that enables the model to generate images using
|
|
211
|
+
* the GPT image models.
|
|
183
212
|
*
|
|
184
|
-
*
|
|
213
|
+
* **When to use**
|
|
214
|
+
*
|
|
215
|
+
* Use to enable OpenAI provider-defined image generation through a language
|
|
216
|
+
* model response.
|
|
217
|
+
*
|
|
218
|
+
* **Details**
|
|
219
|
+
*
|
|
220
|
+
* The tool configures the `image_generation` provider tool, including model,
|
|
221
|
+
* size, quality, output format, moderation, background, input-image options,
|
|
222
|
+
* and partial image settings. Successful tool calls expose `result` as base64
|
|
223
|
+
* image data or `null`.
|
|
185
224
|
*
|
|
186
|
-
* @since 1.0.0
|
|
187
225
|
* @category tools
|
|
226
|
+
* @since 4.0.0
|
|
188
227
|
*/
|
|
189
228
|
export declare const ImageGeneration: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
190
|
-
readonly
|
|
191
|
-
readonly
|
|
192
|
-
readonly quality?: "auto" | "low" | "high" | "medium";
|
|
193
|
-
readonly background?: "auto" | "transparent" | "opaque";
|
|
194
|
-
readonly output_format?: "png" | "webp" | "jpeg";
|
|
195
|
-
readonly output_compression?: number;
|
|
196
|
-
readonly partial_images?: number;
|
|
197
|
-
readonly moderation?: "auto" | "low";
|
|
198
|
-
readonly input_fidelity?: "low" | "high" | null;
|
|
229
|
+
readonly background?: "auto" | "opaque" | "transparent";
|
|
230
|
+
readonly input_fidelity?: "high" | "low" | null;
|
|
199
231
|
readonly input_image_mask?: {
|
|
200
|
-
readonly file_id?: string;
|
|
201
232
|
readonly image_url?: string;
|
|
233
|
+
readonly file_id?: string;
|
|
202
234
|
};
|
|
235
|
+
readonly model?: string;
|
|
236
|
+
readonly moderation?: "auto" | "low";
|
|
237
|
+
readonly output_compression?: number;
|
|
238
|
+
readonly output_format?: "jpeg" | "png" | "webp";
|
|
239
|
+
readonly partial_images?: number;
|
|
240
|
+
readonly quality?: "auto" | "high" | "low" | "medium";
|
|
241
|
+
readonly size?: string;
|
|
203
242
|
}) => Tool.ProviderDefined<"openai.image_generation", "OpenAiImageGeneration", {
|
|
204
243
|
readonly args: Schema.Struct<{
|
|
205
244
|
readonly background: Schema.optionalKey<Schema.Literals<readonly ["transparent", "opaque", "auto"]>>;
|
|
@@ -214,7 +253,7 @@ export declare const ImageGeneration: <Mode extends Tool.FailureMode | undefined
|
|
|
214
253
|
readonly output_format: Schema.optionalKey<Schema.Literals<readonly ["png", "webp", "jpeg"]>>;
|
|
215
254
|
readonly partial_images: Schema.optionalKey<Schema.Number>;
|
|
216
255
|
readonly quality: Schema.optionalKey<Schema.Literals<readonly ["low", "medium", "high", "auto"]>>;
|
|
217
|
-
readonly size: Schema.optionalKey<Schema.Literals<readonly ["1024x1024", "1024x1536", "1536x1024", "auto"]>>;
|
|
256
|
+
readonly size: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Literals<readonly ["1024x1024", "1024x1536", "1536x1024", "auto"]>]>>;
|
|
218
257
|
}>;
|
|
219
258
|
readonly parameters: Schema.Void;
|
|
220
259
|
readonly success: Schema.Struct<{
|
|
@@ -224,13 +263,23 @@ export declare const ImageGeneration: <Mode extends Tool.FailureMode | undefined
|
|
|
224
263
|
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
225
264
|
}, false>;
|
|
226
265
|
/**
|
|
227
|
-
* OpenAI Local Shell tool
|
|
266
|
+
* Defines the OpenAI Local Shell tool that enables the model to run a command with a local
|
|
267
|
+
* shell. This local tool runs in your environment and requires a handler to
|
|
268
|
+
* execute commands.
|
|
269
|
+
*
|
|
270
|
+
* **When to use**
|
|
271
|
+
*
|
|
272
|
+
* Use to let an OpenAI model request local shell commands that your application
|
|
273
|
+
* executes through a handler.
|
|
274
|
+
*
|
|
275
|
+
* **Details**
|
|
228
276
|
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
277
|
+
* The tool exposes a provider-defined `local_shell` call. It is marked as
|
|
278
|
+
* handler-required, so applications must provide the command execution policy
|
|
279
|
+
* and implementation.
|
|
231
280
|
*
|
|
232
|
-
* @since 1.0.0
|
|
233
281
|
* @category tools
|
|
282
|
+
* @since 4.0.0
|
|
234
283
|
*/
|
|
235
284
|
export declare const LocalShell: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
236
285
|
readonly failureMode?: Mode | undefined;
|
|
@@ -239,7 +288,7 @@ export declare const LocalShell: <Mode extends Tool.FailureMode | undefined = un
|
|
|
239
288
|
readonly parameters: Schema.Struct<{
|
|
240
289
|
readonly action: Schema.Struct<{
|
|
241
290
|
readonly type: Schema.Literal<"exec">;
|
|
242
|
-
readonly command: Schema
|
|
291
|
+
readonly command: Schema.$Array<Schema.String>;
|
|
243
292
|
readonly timeout_ms: Schema.optionalKey<Schema.Union<readonly [Schema.Number, Schema.Null]>>;
|
|
244
293
|
readonly working_directory: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
245
294
|
readonly env: Schema.Struct<{}>;
|
|
@@ -253,24 +302,35 @@ export declare const LocalShell: <Mode extends Tool.FailureMode | undefined = un
|
|
|
253
302
|
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
254
303
|
}, true>;
|
|
255
304
|
/**
|
|
256
|
-
* OpenAI MCP tool
|
|
305
|
+
* Defines the OpenAI MCP tool that gives the model access to additional tools via remote
|
|
306
|
+
* Model Context Protocol (MCP) servers.
|
|
257
307
|
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
308
|
+
* **When to use**
|
|
309
|
+
*
|
|
310
|
+
* Use to let an OpenAI model call tools exposed by a remote MCP server.
|
|
311
|
+
*
|
|
312
|
+
* **Details**
|
|
313
|
+
*
|
|
314
|
+
* The tool accepts MCP server configuration such as allowed tools,
|
|
315
|
+
* authorization, connector id, approval requirements, server metadata, and
|
|
316
|
+
* server URL. Tool call results include the called tool name, arguments, output,
|
|
317
|
+
* error, and server label.
|
|
318
|
+
*
|
|
319
|
+
* **Gotchas**
|
|
320
|
+
*
|
|
321
|
+
* This schema leaves both `server_url` and `connector_id` optional, but OpenAI
|
|
322
|
+
* may require a server URL or connector id for a usable MCP tool configuration.
|
|
260
323
|
*
|
|
261
|
-
* @since 1.0.0
|
|
262
324
|
* @category tools
|
|
325
|
+
* @since 4.0.0
|
|
263
326
|
*/
|
|
264
327
|
export declare const Mcp: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
265
|
-
readonly server_label: string;
|
|
266
328
|
readonly allowed_tools?: readonly string[] | {
|
|
267
329
|
readonly tool_names?: readonly string[];
|
|
268
330
|
readonly read_only?: boolean;
|
|
269
331
|
} | null;
|
|
270
|
-
readonly server_url?: string;
|
|
271
|
-
readonly connector_id?: "connector_dropbox" | "connector_gmail" | "connector_googlecalendar" | "connector_googledrive" | "connector_microsoftteams" | "connector_outlookcalendar" | "connector_outlookemail" | "connector_sharepoint";
|
|
272
332
|
readonly authorization?: string;
|
|
273
|
-
readonly
|
|
333
|
+
readonly connector_id?: "connector_dropbox" | "connector_gmail" | "connector_googlecalendar" | "connector_googledrive" | "connector_microsoftteams" | "connector_outlookcalendar" | "connector_outlookemail" | "connector_sharepoint";
|
|
274
334
|
readonly require_approval?: "always" | "never" | {
|
|
275
335
|
readonly always?: {
|
|
276
336
|
readonly tool_names?: readonly string[];
|
|
@@ -281,21 +341,24 @@ export declare const Mcp: <Mode extends Tool.FailureMode | undefined = undefined
|
|
|
281
341
|
readonly read_only?: boolean;
|
|
282
342
|
};
|
|
283
343
|
} | null;
|
|
344
|
+
readonly server_description?: string;
|
|
345
|
+
readonly server_label: string;
|
|
346
|
+
readonly server_url?: string;
|
|
284
347
|
}) => Tool.ProviderDefined<"openai.mcp", "OpenAiMcp", {
|
|
285
348
|
readonly args: Schema.Struct<{
|
|
286
|
-
readonly allowed_tools: Schema.optionalKey<Schema.Union<readonly [Schema.Union<readonly [Schema
|
|
287
|
-
readonly tool_names: Schema.optionalKey<Schema
|
|
349
|
+
readonly allowed_tools: Schema.optionalKey<Schema.Union<readonly [Schema.Union<readonly [Schema.$Array<Schema.String>, Schema.Struct<{
|
|
350
|
+
readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
288
351
|
readonly read_only: Schema.optionalKey<Schema.Boolean>;
|
|
289
352
|
}>]>, Schema.Null]>>;
|
|
290
353
|
readonly authorization: Schema.optionalKey<Schema.String>;
|
|
291
354
|
readonly connector_id: Schema.optionalKey<Schema.Literals<readonly ["connector_dropbox", "connector_gmail", "connector_googlecalendar", "connector_googledrive", "connector_microsoftteams", "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint"]>>;
|
|
292
355
|
readonly require_approval: Schema.optionalKey<Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
293
356
|
readonly always: Schema.optionalKey<Schema.Struct<{
|
|
294
|
-
readonly tool_names: Schema.optionalKey<Schema
|
|
357
|
+
readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
295
358
|
readonly read_only: Schema.optionalKey<Schema.Boolean>;
|
|
296
359
|
}>>;
|
|
297
360
|
readonly never: Schema.optionalKey<Schema.Struct<{
|
|
298
|
-
readonly tool_names: Schema.optionalKey<Schema
|
|
361
|
+
readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
299
362
|
readonly read_only: Schema.optionalKey<Schema.Boolean>;
|
|
300
363
|
}>>;
|
|
301
364
|
}>, Schema.Literals<readonly ["always", "never"]>]>, Schema.Null]>>;
|
|
@@ -303,7 +366,7 @@ export declare const Mcp: <Mode extends Tool.FailureMode | undefined = undefined
|
|
|
303
366
|
readonly server_label: Schema.String;
|
|
304
367
|
readonly server_url: Schema.optionalKey<Schema.String>;
|
|
305
368
|
}>;
|
|
306
|
-
readonly parameters: Schema.
|
|
369
|
+
readonly parameters: Schema.Unknown;
|
|
307
370
|
readonly success: Schema.Struct<{
|
|
308
371
|
readonly type: Schema.Literal<"mcp_call">;
|
|
309
372
|
readonly name: Schema.String;
|
|
@@ -316,14 +379,21 @@ export declare const Mcp: <Mode extends Tool.FailureMode | undefined = undefined
|
|
|
316
379
|
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
317
380
|
}, false>;
|
|
318
381
|
/**
|
|
319
|
-
* OpenAI
|
|
382
|
+
* Defines the OpenAI shell tool for model-requested command execution.
|
|
383
|
+
*
|
|
384
|
+
* **When to use**
|
|
385
|
+
*
|
|
386
|
+
* Use to let an OpenAI model request shell commands that your application
|
|
387
|
+
* executes through a handler.
|
|
320
388
|
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
* a
|
|
389
|
+
* **Details**
|
|
390
|
+
*
|
|
391
|
+
* The tool exposes a provider-defined `shell` call. It is marked as
|
|
392
|
+
* handler-required, so applications must provide the command execution policy
|
|
393
|
+
* and implementation.
|
|
324
394
|
*
|
|
325
|
-
* @since 1.0.0
|
|
326
395
|
* @category tools
|
|
396
|
+
* @since 4.0.0
|
|
327
397
|
*/
|
|
328
398
|
export declare const Shell: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
329
399
|
readonly failureMode?: Mode | undefined;
|
|
@@ -331,13 +401,13 @@ export declare const Shell: <Mode extends Tool.FailureMode | undefined = undefin
|
|
|
331
401
|
readonly args: Schema.Void;
|
|
332
402
|
readonly parameters: Schema.Struct<{
|
|
333
403
|
readonly action: Schema.Struct<{
|
|
334
|
-
readonly commands: Schema
|
|
404
|
+
readonly commands: Schema.$Array<Schema.String>;
|
|
335
405
|
readonly timeout_ms: Schema.Union<readonly [Schema.Number, Schema.Null]>;
|
|
336
406
|
readonly max_output_length: Schema.Union<readonly [Schema.Number, Schema.Null]>;
|
|
337
407
|
}>;
|
|
338
408
|
}>;
|
|
339
409
|
readonly success: Schema.Struct<{
|
|
340
|
-
readonly output: Schema
|
|
410
|
+
readonly output: Schema.$Array<Schema.Struct<{
|
|
341
411
|
readonly stdout: Schema.String;
|
|
342
412
|
readonly stderr: Schema.String;
|
|
343
413
|
readonly outcome: Schema.Union<readonly [Schema.Struct<{
|
|
@@ -346,20 +416,34 @@ export declare const Shell: <Mode extends Tool.FailureMode | undefined = undefin
|
|
|
346
416
|
readonly type: Schema.Literal<"exit">;
|
|
347
417
|
readonly exit_code: Schema.Number;
|
|
348
418
|
}>]>;
|
|
419
|
+
readonly created_by: Schema.optionalKey<Schema.String>;
|
|
349
420
|
}>>;
|
|
350
421
|
}>;
|
|
351
422
|
readonly failure: Schema.Never;
|
|
352
423
|
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
353
424
|
}, true>;
|
|
354
425
|
/**
|
|
355
|
-
* OpenAI Web Search tool
|
|
426
|
+
* Defines the OpenAI Web Search tool that enables the model to search the web for
|
|
427
|
+
* information.
|
|
428
|
+
*
|
|
429
|
+
* **When to use**
|
|
430
|
+
*
|
|
431
|
+
* Use to enable OpenAI provider-defined web search for a model response.
|
|
432
|
+
*
|
|
433
|
+
* **Details**
|
|
356
434
|
*
|
|
357
|
-
*
|
|
435
|
+
* The tool accepts optional filters, user location, and search context size.
|
|
436
|
+
* Successful calls expose the performed search action and status.
|
|
437
|
+
*
|
|
438
|
+
* @see {@link WebSearchPreview} for the preview web search provider tool
|
|
358
439
|
*
|
|
359
|
-
* @since 1.0.0
|
|
360
440
|
* @category tools
|
|
441
|
+
* @since 4.0.0
|
|
361
442
|
*/
|
|
362
443
|
export declare const WebSearch: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
444
|
+
readonly filters?: {
|
|
445
|
+
readonly allowed_domains?: readonly string[] | null;
|
|
446
|
+
} | null;
|
|
363
447
|
readonly user_location?: {
|
|
364
448
|
readonly type?: "approximate";
|
|
365
449
|
readonly country?: string | null;
|
|
@@ -367,14 +451,11 @@ export declare const WebSearch: <Mode extends Tool.FailureMode | undefined = und
|
|
|
367
451
|
readonly city?: string | null;
|
|
368
452
|
readonly timezone?: string | null;
|
|
369
453
|
} | null;
|
|
370
|
-
readonly search_context_size?: "
|
|
371
|
-
readonly filters?: {
|
|
372
|
-
readonly allowed_domains?: readonly string[] | null;
|
|
373
|
-
} | null;
|
|
454
|
+
readonly search_context_size?: "high" | "low" | "medium";
|
|
374
455
|
}) => Tool.ProviderDefined<"openai.web_search", "OpenAiWebSearch", {
|
|
375
456
|
readonly args: Schema.Struct<{
|
|
376
457
|
readonly filters: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
377
|
-
readonly allowed_domains: Schema.optionalKey<Schema.Union<readonly [Schema
|
|
458
|
+
readonly allowed_domains: Schema.optionalKey<Schema.Union<readonly [Schema.$Array<Schema.String>, Schema.Null]>>;
|
|
378
459
|
}>, Schema.Null]>>;
|
|
379
460
|
readonly user_location: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
380
461
|
readonly type: Schema.optionalKey<Schema.Literal<"approximate">>;
|
|
@@ -389,8 +470,8 @@ export declare const WebSearch: <Mode extends Tool.FailureMode | undefined = und
|
|
|
389
470
|
readonly action: Schema.Union<readonly [Schema.Struct<{
|
|
390
471
|
readonly type: Schema.Literal<"search">;
|
|
391
472
|
readonly query: Schema.optionalKey<Schema.String>;
|
|
392
|
-
readonly queries: Schema.optionalKey<Schema
|
|
393
|
-
readonly sources: Schema.optionalKey<Schema
|
|
473
|
+
readonly queries: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
474
|
+
readonly sources: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
394
475
|
readonly type: Schema.Literal<"url">;
|
|
395
476
|
readonly url: Schema.String;
|
|
396
477
|
}>>>;
|
|
@@ -407,8 +488,8 @@ export declare const WebSearch: <Mode extends Tool.FailureMode | undefined = und
|
|
|
407
488
|
readonly action: Schema.Union<readonly [Schema.Struct<{
|
|
408
489
|
readonly type: Schema.Literal<"search">;
|
|
409
490
|
readonly query: Schema.optionalKey<Schema.String>;
|
|
410
|
-
readonly queries: Schema.optionalKey<Schema
|
|
411
|
-
readonly sources: Schema.optionalKey<Schema
|
|
491
|
+
readonly queries: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
492
|
+
readonly sources: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
412
493
|
readonly type: Schema.Literal<"url">;
|
|
413
494
|
readonly url: Schema.String;
|
|
414
495
|
}>>>;
|
|
@@ -426,12 +507,21 @@ export declare const WebSearch: <Mode extends Tool.FailureMode | undefined = und
|
|
|
426
507
|
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
427
508
|
}, false>;
|
|
428
509
|
/**
|
|
429
|
-
* OpenAI Web Search
|
|
510
|
+
* Defines the OpenAI preview Web Search tool for model responses.
|
|
511
|
+
*
|
|
512
|
+
* **When to use**
|
|
513
|
+
*
|
|
514
|
+
* Use to enable the preview OpenAI web search provider tool.
|
|
515
|
+
*
|
|
516
|
+
* **Details**
|
|
517
|
+
*
|
|
518
|
+
* The preview tool accepts optional user location and search context size, then
|
|
519
|
+
* exposes the performed search action and status in successful calls.
|
|
430
520
|
*
|
|
431
|
-
*
|
|
521
|
+
* @see {@link WebSearch} for the stable web search provider tool
|
|
432
522
|
*
|
|
433
|
-
* @since 1.0.0
|
|
434
523
|
* @category tools
|
|
524
|
+
* @since 4.0.0
|
|
435
525
|
*/
|
|
436
526
|
export declare const WebSearchPreview: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
437
527
|
readonly user_location?: {
|
|
@@ -441,7 +531,7 @@ export declare const WebSearchPreview: <Mode extends Tool.FailureMode | undefine
|
|
|
441
531
|
readonly city?: string | null;
|
|
442
532
|
readonly timezone?: string | null;
|
|
443
533
|
} | null;
|
|
444
|
-
readonly search_context_size?: "
|
|
534
|
+
readonly search_context_size?: "high" | "low" | "medium";
|
|
445
535
|
}) => Tool.ProviderDefined<"openai.web_search_preview", "OpenAiWebSearchPreview", {
|
|
446
536
|
readonly args: Schema.Struct<{
|
|
447
537
|
readonly user_location: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
@@ -458,8 +548,8 @@ export declare const WebSearchPreview: <Mode extends Tool.FailureMode | undefine
|
|
|
458
548
|
readonly action: Schema.Union<readonly [Schema.Struct<{
|
|
459
549
|
readonly type: Schema.Literal<"search">;
|
|
460
550
|
readonly query: Schema.optionalKey<Schema.String>;
|
|
461
|
-
readonly queries: Schema.optionalKey<Schema
|
|
462
|
-
readonly sources: Schema.optionalKey<Schema
|
|
551
|
+
readonly queries: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
552
|
+
readonly sources: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
463
553
|
readonly type: Schema.Literal<"url">;
|
|
464
554
|
readonly url: Schema.String;
|
|
465
555
|
}>>>;
|
package/dist/OpenAiTool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAiTool.d.ts","sourceRoot":"","sources":["../src/OpenAiTool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"OpenAiTool.d.ts","sourceRoot":"","sources":["../src/OpenAiTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,IAAI,MAAM,yBAAyB,CAAA;AAG/C;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB,UAAU,CAAC,OAAO,UAAU,CAAC,GAC7B,UAAU,CAAC,OAAO,eAAe,CAAC,GAClC,UAAU,CAAC,OAAO,UAAU,CAAC,GAC7B,UAAU,CAAC,OAAO,KAAK,CAAC,GACxB,UAAU,CAAC,OAAO,eAAe,CAAC,GAClC,UAAU,CAAC,OAAO,UAAU,CAAC,GAC7B,UAAU,CAAC,OAAO,GAAG,CAAC,GACtB,UAAU,CAAC,OAAO,SAAS,CAAC,GAC5B,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEvC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;QAarB,CAAA;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAc1B,CAAA;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAerB,CAAA;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAmB1B,CAAA;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;QAWrB,CAAA;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAsBd,CAAA;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;QAWhB,CAAA;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAgBpB,CAAA;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAY3B,CAAA"}
|