@effect/ai-openai 0.37.2 → 4.0.0-beta.1
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 +70887 -0
- package/dist/Generated.d.ts.map +1 -0
- package/dist/Generated.js +4 -0
- package/dist/Generated.js.map +1 -0
- package/dist/OpenAiClient.d.ts +124 -0
- package/dist/OpenAiClient.d.ts.map +1 -0
- package/dist/OpenAiClient.js +128 -0
- package/dist/OpenAiClient.js.map +1 -0
- package/dist/{dts/OpenAiConfig.d.ts → OpenAiConfig.d.ts} +9 -9
- package/dist/OpenAiConfig.d.ts.map +1 -0
- package/dist/{esm/OpenAiConfig.js → OpenAiConfig.js} +8 -5
- package/dist/OpenAiConfig.js.map +1 -0
- package/dist/OpenAiError.d.ts +98 -0
- package/dist/OpenAiError.d.ts.map +1 -0
- package/dist/OpenAiError.js +10 -0
- package/dist/OpenAiError.js.map +1 -0
- package/dist/OpenAiLanguageModel.d.ts +318 -0
- package/dist/OpenAiLanguageModel.d.ts.map +1 -0
- package/dist/OpenAiLanguageModel.js +2207 -0
- package/dist/OpenAiLanguageModel.js.map +1 -0
- package/dist/{dts/OpenAiTelemetry.d.ts → OpenAiTelemetry.d.ts} +31 -13
- package/dist/OpenAiTelemetry.d.ts.map +1 -0
- package/dist/{esm/OpenAiTelemetry.js → OpenAiTelemetry.js} +11 -6
- package/dist/OpenAiTelemetry.js.map +1 -0
- package/dist/OpenAiTool.d.ts +479 -0
- package/dist/OpenAiTool.d.ts.map +1 -0
- package/dist/OpenAiTool.js +231 -0
- package/dist/OpenAiTool.js.map +1 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/errors.d.ts +2 -0
- package/dist/internal/errors.d.ts.map +1 -0
- package/dist/internal/errors.js +316 -0
- package/dist/internal/errors.js.map +1 -0
- package/dist/{dts/internal → internal}/utilities.d.ts.map +1 -1
- package/dist/{esm/internal → internal}/utilities.js +4 -3
- package/dist/internal/utilities.js.map +1 -0
- package/package.json +45 -97
- package/src/Generated.ts +28521 -20036
- package/src/OpenAiClient.ts +220 -1816
- package/src/OpenAiConfig.ts +20 -34
- package/src/OpenAiError.ts +107 -0
- package/src/OpenAiLanguageModel.ts +1807 -638
- package/src/OpenAiTelemetry.ts +24 -19
- package/src/OpenAiTool.ts +216 -70
- package/src/index.ts +35 -8
- package/src/internal/errors.ts +347 -0
- package/src/internal/utilities.ts +7 -5
- package/Generated/package.json +0 -6
- package/OpenAiClient/package.json +0 -6
- package/OpenAiConfig/package.json +0 -6
- package/OpenAiEmbeddingModel/package.json +0 -6
- package/OpenAiLanguageModel/package.json +0 -6
- package/OpenAiTelemetry/package.json +0 -6
- package/OpenAiTokenizer/package.json +0 -6
- package/OpenAiTool/package.json +0 -6
- package/README.md +0 -5
- package/dist/cjs/Generated.js +0 -7150
- package/dist/cjs/Generated.js.map +0 -1
- package/dist/cjs/OpenAiClient.js +0 -1567
- package/dist/cjs/OpenAiClient.js.map +0 -1
- package/dist/cjs/OpenAiConfig.js +0 -30
- package/dist/cjs/OpenAiConfig.js.map +0 -1
- package/dist/cjs/OpenAiEmbeddingModel.js +0 -155
- package/dist/cjs/OpenAiEmbeddingModel.js.map +0 -1
- package/dist/cjs/OpenAiLanguageModel.js +0 -1147
- package/dist/cjs/OpenAiLanguageModel.js.map +0 -1
- package/dist/cjs/OpenAiTelemetry.js +0 -38
- package/dist/cjs/OpenAiTelemetry.js.map +0 -1
- package/dist/cjs/OpenAiTokenizer.js +0 -83
- package/dist/cjs/OpenAiTokenizer.js.map +0 -1
- package/dist/cjs/OpenAiTool.js +0 -93
- package/dist/cjs/OpenAiTool.js.map +0 -1
- package/dist/cjs/index.js +0 -24
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/internal/utilities.js +0 -32
- package/dist/cjs/internal/utilities.js.map +0 -1
- package/dist/dts/Generated.d.ts +0 -40661
- package/dist/dts/Generated.d.ts.map +0 -1
- package/dist/dts/OpenAiClient.d.ts +0 -3120
- package/dist/dts/OpenAiClient.d.ts.map +0 -1
- package/dist/dts/OpenAiConfig.d.ts.map +0 -1
- package/dist/dts/OpenAiEmbeddingModel.d.ts +0 -109
- package/dist/dts/OpenAiEmbeddingModel.d.ts.map +0 -1
- package/dist/dts/OpenAiLanguageModel.d.ts +0 -235
- package/dist/dts/OpenAiLanguageModel.d.ts.map +0 -1
- package/dist/dts/OpenAiTelemetry.d.ts.map +0 -1
- package/dist/dts/OpenAiTokenizer.d.ts +0 -17
- package/dist/dts/OpenAiTokenizer.d.ts.map +0 -1
- package/dist/dts/OpenAiTool.d.ts +0 -200
- package/dist/dts/OpenAiTool.d.ts.map +0 -1
- package/dist/dts/index.d.ts +0 -33
- package/dist/dts/index.d.ts.map +0 -1
- package/dist/esm/Generated.js +0 -7150
- package/dist/esm/Generated.js.map +0 -1
- package/dist/esm/OpenAiClient.js +0 -1504
- package/dist/esm/OpenAiClient.js.map +0 -1
- package/dist/esm/OpenAiConfig.js.map +0 -1
- package/dist/esm/OpenAiEmbeddingModel.js +0 -143
- package/dist/esm/OpenAiEmbeddingModel.js.map +0 -1
- package/dist/esm/OpenAiLanguageModel.js +0 -1134
- package/dist/esm/OpenAiLanguageModel.js.map +0 -1
- package/dist/esm/OpenAiTelemetry.js.map +0 -1
- package/dist/esm/OpenAiTokenizer.js +0 -73
- package/dist/esm/OpenAiTokenizer.js.map +0 -1
- package/dist/esm/OpenAiTool.js +0 -84
- package/dist/esm/OpenAiTool.js.map +0 -1
- package/dist/esm/index.js +0 -33
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/internal/utilities.js.map +0 -1
- package/dist/esm/package.json +0 -4
- package/index/package.json +0 -6
- package/src/OpenAiEmbeddingModel.ts +0 -243
- package/src/OpenAiTokenizer.ts +0 -70
- /package/dist/{dts/internal → internal}/utilities.d.ts +0 -0
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI provider-defined tools for use with the LanguageModel.
|
|
3
|
+
*
|
|
4
|
+
* Provides tools that are natively supported by OpenAI's API, including
|
|
5
|
+
* code interpreter, file search, and web search functionality.
|
|
6
|
+
*
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
*/
|
|
9
|
+
import * as Schema from "effect/Schema";
|
|
10
|
+
import * as Tool from "effect/unstable/ai/Tool";
|
|
11
|
+
/**
|
|
12
|
+
* Union of all OpenAI provider-defined tools.
|
|
13
|
+
*
|
|
14
|
+
* @since 1.0.0
|
|
15
|
+
* @category models
|
|
16
|
+
*/
|
|
17
|
+
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
|
+
* OpenAI Apply Patch tool.
|
|
20
|
+
*
|
|
21
|
+
* Allows the model to apply diffs by creating, deleting, or updating files.
|
|
22
|
+
* This is a local tool that runs in your environment and requires a handler
|
|
23
|
+
* to execute file operations.
|
|
24
|
+
*
|
|
25
|
+
* @since 1.0.0
|
|
26
|
+
* @category tools
|
|
27
|
+
*/
|
|
28
|
+
export declare const ApplyPatch: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
29
|
+
readonly failureMode?: Mode | undefined;
|
|
30
|
+
}) => Tool.ProviderDefined<"openai.apply_patch", "OpenAiApplyPatch", {
|
|
31
|
+
readonly args: Schema.Void;
|
|
32
|
+
readonly parameters: Schema.Struct<{
|
|
33
|
+
readonly call_id: Schema.String;
|
|
34
|
+
readonly operation: Schema.Union<readonly [Schema.Struct<{
|
|
35
|
+
readonly type: Schema.Literal<"create_file">;
|
|
36
|
+
readonly path: Schema.String;
|
|
37
|
+
readonly diff: Schema.String;
|
|
38
|
+
}>, Schema.Struct<{
|
|
39
|
+
readonly type: Schema.Literal<"delete_file">;
|
|
40
|
+
readonly path: Schema.String;
|
|
41
|
+
}>, Schema.Struct<{
|
|
42
|
+
readonly type: Schema.Literal<"update_file">;
|
|
43
|
+
readonly path: Schema.String;
|
|
44
|
+
readonly diff: Schema.String;
|
|
45
|
+
}>]>;
|
|
46
|
+
}>;
|
|
47
|
+
readonly success: Schema.Struct<{
|
|
48
|
+
readonly status: Schema.Literals<readonly ["completed", "failed"]>;
|
|
49
|
+
readonly output: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
50
|
+
}>;
|
|
51
|
+
readonly failure: Schema.Never;
|
|
52
|
+
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
53
|
+
}, true>;
|
|
54
|
+
/**
|
|
55
|
+
* OpenAI Code Interpreter tool.
|
|
56
|
+
*
|
|
57
|
+
* Allows the model to execute Python code in a sandboxed environment.
|
|
58
|
+
*
|
|
59
|
+
* @since 1.0.0
|
|
60
|
+
* @category tools
|
|
61
|
+
*/
|
|
62
|
+
export declare const CodeInterpreter: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
63
|
+
readonly container: string | {
|
|
64
|
+
readonly type: "auto";
|
|
65
|
+
readonly memory_limit?: "1g" | "4g" | "16g" | "64g" | null;
|
|
66
|
+
readonly network_policy?: {
|
|
67
|
+
readonly type: "disabled";
|
|
68
|
+
} | {
|
|
69
|
+
readonly type: "allowlist";
|
|
70
|
+
readonly allowed_domains: readonly string[];
|
|
71
|
+
readonly domain_secrets?: readonly {
|
|
72
|
+
readonly value: string;
|
|
73
|
+
readonly name: string;
|
|
74
|
+
readonly domain: string;
|
|
75
|
+
}[];
|
|
76
|
+
};
|
|
77
|
+
readonly file_ids?: readonly string[];
|
|
78
|
+
};
|
|
79
|
+
}) => Tool.ProviderDefined<"openai.code_interpreter", "OpenAiCodeInterpreter", {
|
|
80
|
+
readonly args: Schema.Struct<{
|
|
81
|
+
readonly container: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
82
|
+
readonly type: Schema.Literal<"auto">;
|
|
83
|
+
readonly file_ids: Schema.optionalKey<Schema.Array$<Schema.String>>;
|
|
84
|
+
readonly memory_limit: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["1g", "4g", "16g", "64g"]>, Schema.Null]>>;
|
|
85
|
+
readonly network_policy: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
86
|
+
readonly type: Schema.Literal<"disabled">;
|
|
87
|
+
}>, Schema.Struct<{
|
|
88
|
+
readonly type: Schema.Literal<"allowlist">;
|
|
89
|
+
readonly allowed_domains: Schema.Array$<Schema.String>;
|
|
90
|
+
readonly domain_secrets: Schema.optionalKey<Schema.Array$<Schema.Struct<{
|
|
91
|
+
readonly domain: Schema.String;
|
|
92
|
+
readonly name: Schema.String;
|
|
93
|
+
readonly value: Schema.String;
|
|
94
|
+
}>>>;
|
|
95
|
+
}>]>>;
|
|
96
|
+
}>]>;
|
|
97
|
+
}>;
|
|
98
|
+
readonly parameters: Schema.Struct<{
|
|
99
|
+
readonly code: Schema.Union<readonly [Schema.String, Schema.Null]>;
|
|
100
|
+
readonly container_id: Schema.String;
|
|
101
|
+
}>;
|
|
102
|
+
readonly success: Schema.Struct<{
|
|
103
|
+
readonly outputs: Schema.Union<readonly [Schema.Array$<Schema.Union<readonly [Schema.Struct<{
|
|
104
|
+
readonly type: Schema.Literal<"logs">;
|
|
105
|
+
readonly logs: Schema.String;
|
|
106
|
+
}>, Schema.Struct<{
|
|
107
|
+
readonly type: Schema.Literal<"image">;
|
|
108
|
+
readonly url: Schema.String;
|
|
109
|
+
}>]>>, Schema.Null]>;
|
|
110
|
+
}>;
|
|
111
|
+
readonly failure: Schema.Never;
|
|
112
|
+
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
113
|
+
}, false>;
|
|
114
|
+
/**
|
|
115
|
+
* OpenAI File Search tool.
|
|
116
|
+
*
|
|
117
|
+
* Enables the model to search through uploaded files and vector stores.
|
|
118
|
+
*
|
|
119
|
+
* @since 1.0.0
|
|
120
|
+
* @category tools
|
|
121
|
+
*/
|
|
122
|
+
export declare const FileSearch: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
123
|
+
readonly vector_store_ids: readonly string[];
|
|
124
|
+
readonly filters?: {
|
|
125
|
+
readonly value: string | number | boolean | readonly (string | number)[];
|
|
126
|
+
readonly type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
|
|
127
|
+
readonly key: string;
|
|
128
|
+
} | {
|
|
129
|
+
readonly type: "and" | "or";
|
|
130
|
+
readonly filters: readonly unknown[];
|
|
131
|
+
} | null;
|
|
132
|
+
readonly max_num_results?: number;
|
|
133
|
+
readonly ranking_options?: {
|
|
134
|
+
readonly ranker?: "auto" | "default-2024-11-15";
|
|
135
|
+
readonly score_threshold?: number;
|
|
136
|
+
readonly hybrid_search?: {
|
|
137
|
+
readonly embedding_weight: number;
|
|
138
|
+
readonly text_weight: number;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
}) => Tool.ProviderDefined<"openai.file_search", "OpenAiFileSearch", {
|
|
142
|
+
readonly args: Schema.Struct<{
|
|
143
|
+
readonly filters: Schema.optionalKey<Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
144
|
+
readonly type: Schema.Literals<readonly ["eq", "ne", "gt", "gte", "lt", "lte"]>;
|
|
145
|
+
readonly key: Schema.String;
|
|
146
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.Array$<Schema.Union<readonly [Schema.String, Schema.Number]>>]>;
|
|
147
|
+
}>, Schema.Struct<{
|
|
148
|
+
readonly type: Schema.Literals<readonly ["and", "or"]>;
|
|
149
|
+
readonly filters: Schema.Array$<Schema.Union<readonly [Schema.Struct<{
|
|
150
|
+
readonly type: Schema.Literals<readonly ["eq", "ne", "gt", "gte", "lt", "lte"]>;
|
|
151
|
+
readonly key: Schema.String;
|
|
152
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.Array$<Schema.Union<readonly [Schema.String, Schema.Number]>>]>;
|
|
153
|
+
}>, Schema.Unknown]>>;
|
|
154
|
+
}>]>, Schema.Null]>>;
|
|
155
|
+
readonly max_num_results: Schema.optionalKey<Schema.Number>;
|
|
156
|
+
readonly ranking_options: Schema.optionalKey<Schema.Struct<{
|
|
157
|
+
readonly ranker: Schema.optionalKey<Schema.Literals<readonly ["auto", "default-2024-11-15"]>>;
|
|
158
|
+
readonly score_threshold: Schema.optionalKey<Schema.Number>;
|
|
159
|
+
readonly hybrid_search: Schema.optionalKey<Schema.Struct<{
|
|
160
|
+
readonly embedding_weight: Schema.Number;
|
|
161
|
+
readonly text_weight: Schema.Number;
|
|
162
|
+
}>>;
|
|
163
|
+
}>>;
|
|
164
|
+
readonly vector_store_ids: Schema.Array$<Schema.String>;
|
|
165
|
+
}>;
|
|
166
|
+
readonly parameters: Schema.Void;
|
|
167
|
+
readonly success: Schema.Struct<{
|
|
168
|
+
readonly status: Schema.Literals<readonly ["in_progress", "searching", "completed", "incomplete", "failed"]>;
|
|
169
|
+
readonly queries: Schema.Array$<Schema.String>;
|
|
170
|
+
readonly results: Schema.optionalKey<Schema.Union<readonly [Schema.Array$<Schema.Struct<{
|
|
171
|
+
readonly file_id: Schema.optionalKey<Schema.String>;
|
|
172
|
+
readonly text: Schema.optionalKey<Schema.String>;
|
|
173
|
+
readonly filename: Schema.optionalKey<Schema.String>;
|
|
174
|
+
readonly attributes: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{}>, Schema.Null]>>;
|
|
175
|
+
readonly score: Schema.optionalKey<Schema.Number>;
|
|
176
|
+
}>>, Schema.Null]>>;
|
|
177
|
+
}>;
|
|
178
|
+
readonly failure: Schema.Never;
|
|
179
|
+
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
180
|
+
}, false>;
|
|
181
|
+
/**
|
|
182
|
+
* OpenAI Image Generation tool.
|
|
183
|
+
*
|
|
184
|
+
* Enables the model to generate images using the GPT image models.
|
|
185
|
+
*
|
|
186
|
+
* @since 1.0.0
|
|
187
|
+
* @category tools
|
|
188
|
+
*/
|
|
189
|
+
export declare const ImageGeneration: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
190
|
+
readonly model?: string;
|
|
191
|
+
readonly size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
|
|
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;
|
|
199
|
+
readonly input_image_mask?: {
|
|
200
|
+
readonly file_id?: string;
|
|
201
|
+
readonly image_url?: string;
|
|
202
|
+
};
|
|
203
|
+
}) => Tool.ProviderDefined<"openai.image_generation", "OpenAiImageGeneration", {
|
|
204
|
+
readonly args: Schema.Struct<{
|
|
205
|
+
readonly background: Schema.optionalKey<Schema.Literals<readonly ["transparent", "opaque", "auto"]>>;
|
|
206
|
+
readonly input_fidelity: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["high", "low"]>, Schema.Null]>>;
|
|
207
|
+
readonly input_image_mask: Schema.optionalKey<Schema.Struct<{
|
|
208
|
+
readonly image_url: Schema.optionalKey<Schema.String>;
|
|
209
|
+
readonly file_id: Schema.optionalKey<Schema.String>;
|
|
210
|
+
}>>;
|
|
211
|
+
readonly model: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Literals<readonly ["gpt-image-1", "gpt-image-1-mini", "gpt-image-1.5"]>]>>;
|
|
212
|
+
readonly moderation: Schema.optionalKey<Schema.Literals<readonly ["auto", "low"]>>;
|
|
213
|
+
readonly output_compression: Schema.optionalKey<Schema.Number>;
|
|
214
|
+
readonly output_format: Schema.optionalKey<Schema.Literals<readonly ["png", "webp", "jpeg"]>>;
|
|
215
|
+
readonly partial_images: Schema.optionalKey<Schema.Number>;
|
|
216
|
+
readonly quality: Schema.optionalKey<Schema.Literals<readonly ["low", "medium", "high", "auto"]>>;
|
|
217
|
+
readonly size: Schema.optionalKey<Schema.Literals<readonly ["1024x1024", "1024x1536", "1536x1024", "auto"]>>;
|
|
218
|
+
}>;
|
|
219
|
+
readonly parameters: Schema.Void;
|
|
220
|
+
readonly success: Schema.Struct<{
|
|
221
|
+
readonly result: Schema.Union<readonly [Schema.String, Schema.Null]>;
|
|
222
|
+
}>;
|
|
223
|
+
readonly failure: Schema.Never;
|
|
224
|
+
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
225
|
+
}, false>;
|
|
226
|
+
/**
|
|
227
|
+
* OpenAI Local Shell tool.
|
|
228
|
+
*
|
|
229
|
+
* Enables the model to run a command with a local shell. This is a local tool
|
|
230
|
+
* that runs in your environment and requires a handler to execute commands.
|
|
231
|
+
*
|
|
232
|
+
* @since 1.0.0
|
|
233
|
+
* @category tools
|
|
234
|
+
*/
|
|
235
|
+
export declare const LocalShell: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
236
|
+
readonly failureMode?: Mode | undefined;
|
|
237
|
+
}) => Tool.ProviderDefined<"openai.local_shell", "OpenAiLocalShell", {
|
|
238
|
+
readonly args: Schema.Void;
|
|
239
|
+
readonly parameters: Schema.Struct<{
|
|
240
|
+
readonly action: Schema.Struct<{
|
|
241
|
+
readonly type: Schema.Literal<"exec">;
|
|
242
|
+
readonly command: Schema.Array$<Schema.String>;
|
|
243
|
+
readonly timeout_ms: Schema.optionalKey<Schema.Union<readonly [Schema.Number, Schema.Null]>>;
|
|
244
|
+
readonly working_directory: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
245
|
+
readonly env: Schema.Struct<{}>;
|
|
246
|
+
readonly user: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
247
|
+
}>;
|
|
248
|
+
}>;
|
|
249
|
+
readonly success: Schema.Struct<{
|
|
250
|
+
readonly output: Schema.String;
|
|
251
|
+
}>;
|
|
252
|
+
readonly failure: Schema.Never;
|
|
253
|
+
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
254
|
+
}, true>;
|
|
255
|
+
/**
|
|
256
|
+
* OpenAI MCP tool.
|
|
257
|
+
*
|
|
258
|
+
* Gives the model access to additional tools via remote Model Context Protocol
|
|
259
|
+
* (MCP) servers
|
|
260
|
+
*
|
|
261
|
+
* @since 1.0.0
|
|
262
|
+
* @category tools
|
|
263
|
+
*/
|
|
264
|
+
export declare const Mcp: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
265
|
+
readonly server_label: string;
|
|
266
|
+
readonly allowed_tools?: readonly string[] | {
|
|
267
|
+
readonly tool_names?: readonly string[];
|
|
268
|
+
readonly read_only?: boolean;
|
|
269
|
+
} | 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
|
+
readonly authorization?: string;
|
|
273
|
+
readonly server_description?: string;
|
|
274
|
+
readonly require_approval?: "always" | "never" | {
|
|
275
|
+
readonly always?: {
|
|
276
|
+
readonly tool_names?: readonly string[];
|
|
277
|
+
readonly read_only?: boolean;
|
|
278
|
+
};
|
|
279
|
+
readonly never?: {
|
|
280
|
+
readonly tool_names?: readonly string[];
|
|
281
|
+
readonly read_only?: boolean;
|
|
282
|
+
};
|
|
283
|
+
} | null;
|
|
284
|
+
}) => Tool.ProviderDefined<"openai.mcp", "OpenAiMcp", {
|
|
285
|
+
readonly args: Schema.Struct<{
|
|
286
|
+
readonly allowed_tools: Schema.optionalKey<Schema.Union<readonly [Schema.Union<readonly [Schema.Array$<Schema.String>, Schema.Struct<{
|
|
287
|
+
readonly tool_names: Schema.optionalKey<Schema.Array$<Schema.String>>;
|
|
288
|
+
readonly read_only: Schema.optionalKey<Schema.Boolean>;
|
|
289
|
+
}>]>, Schema.Null]>>;
|
|
290
|
+
readonly authorization: Schema.optionalKey<Schema.String>;
|
|
291
|
+
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
|
+
readonly require_approval: Schema.optionalKey<Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
293
|
+
readonly always: Schema.optionalKey<Schema.Struct<{
|
|
294
|
+
readonly tool_names: Schema.optionalKey<Schema.Array$<Schema.String>>;
|
|
295
|
+
readonly read_only: Schema.optionalKey<Schema.Boolean>;
|
|
296
|
+
}>>;
|
|
297
|
+
readonly never: Schema.optionalKey<Schema.Struct<{
|
|
298
|
+
readonly tool_names: Schema.optionalKey<Schema.Array$<Schema.String>>;
|
|
299
|
+
readonly read_only: Schema.optionalKey<Schema.Boolean>;
|
|
300
|
+
}>>;
|
|
301
|
+
}>, Schema.Literals<readonly ["always", "never"]>]>, Schema.Null]>>;
|
|
302
|
+
readonly server_description: Schema.optionalKey<Schema.String>;
|
|
303
|
+
readonly server_label: Schema.String;
|
|
304
|
+
readonly server_url: Schema.optionalKey<Schema.String>;
|
|
305
|
+
}>;
|
|
306
|
+
readonly parameters: Schema.Void;
|
|
307
|
+
readonly success: Schema.Struct<{
|
|
308
|
+
readonly type: Schema.Literal<"mcp_call">;
|
|
309
|
+
readonly name: Schema.String;
|
|
310
|
+
readonly arguments: Schema.String;
|
|
311
|
+
readonly output: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
312
|
+
readonly error: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
313
|
+
readonly server_label: Schema.String;
|
|
314
|
+
}>;
|
|
315
|
+
readonly failure: Schema.Never;
|
|
316
|
+
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
317
|
+
}, false>;
|
|
318
|
+
/**
|
|
319
|
+
* OpenAI Function Shell tool.
|
|
320
|
+
*
|
|
321
|
+
* Enables the model to execute one or more shell commands in a managed
|
|
322
|
+
* environment. This is a local tool that runs in your environment and requires
|
|
323
|
+
* a handler to execute commands.
|
|
324
|
+
*
|
|
325
|
+
* @since 1.0.0
|
|
326
|
+
* @category tools
|
|
327
|
+
*/
|
|
328
|
+
export declare const Shell: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
329
|
+
readonly failureMode?: Mode | undefined;
|
|
330
|
+
}) => Tool.ProviderDefined<"openai.shell", "OpenAiShell", {
|
|
331
|
+
readonly args: Schema.Void;
|
|
332
|
+
readonly parameters: Schema.Struct<{
|
|
333
|
+
readonly action: Schema.Struct<{
|
|
334
|
+
readonly commands: Schema.Array$<Schema.String>;
|
|
335
|
+
readonly timeout_ms: Schema.Union<readonly [Schema.Number, Schema.Null]>;
|
|
336
|
+
readonly max_output_length: Schema.Union<readonly [Schema.Number, Schema.Null]>;
|
|
337
|
+
}>;
|
|
338
|
+
}>;
|
|
339
|
+
readonly success: Schema.Struct<{
|
|
340
|
+
readonly output: Schema.Array$<Schema.Struct<{
|
|
341
|
+
readonly stdout: Schema.String;
|
|
342
|
+
readonly stderr: Schema.String;
|
|
343
|
+
readonly outcome: Schema.Union<readonly [Schema.Struct<{
|
|
344
|
+
readonly type: Schema.Literal<"timeout">;
|
|
345
|
+
}>, Schema.Struct<{
|
|
346
|
+
readonly type: Schema.Literal<"exit">;
|
|
347
|
+
readonly exit_code: Schema.Number;
|
|
348
|
+
}>]>;
|
|
349
|
+
}>>;
|
|
350
|
+
}>;
|
|
351
|
+
readonly failure: Schema.Never;
|
|
352
|
+
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
353
|
+
}, true>;
|
|
354
|
+
/**
|
|
355
|
+
* OpenAI Web Search tool.
|
|
356
|
+
*
|
|
357
|
+
* Enables the model to search the web for information.
|
|
358
|
+
*
|
|
359
|
+
* @since 1.0.0
|
|
360
|
+
* @category tools
|
|
361
|
+
*/
|
|
362
|
+
export declare const WebSearch: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
363
|
+
readonly user_location?: {
|
|
364
|
+
readonly type?: "approximate";
|
|
365
|
+
readonly country?: string | null;
|
|
366
|
+
readonly region?: string | null;
|
|
367
|
+
readonly city?: string | null;
|
|
368
|
+
readonly timezone?: string | null;
|
|
369
|
+
} | null;
|
|
370
|
+
readonly search_context_size?: "low" | "high" | "medium";
|
|
371
|
+
readonly filters?: {
|
|
372
|
+
readonly allowed_domains?: readonly string[] | null;
|
|
373
|
+
} | null;
|
|
374
|
+
}) => Tool.ProviderDefined<"openai.web_search", "OpenAiWebSearch", {
|
|
375
|
+
readonly args: Schema.Struct<{
|
|
376
|
+
readonly filters: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
377
|
+
readonly allowed_domains: Schema.optionalKey<Schema.Union<readonly [Schema.Array$<Schema.String>, Schema.Null]>>;
|
|
378
|
+
}>, Schema.Null]>>;
|
|
379
|
+
readonly user_location: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
380
|
+
readonly type: Schema.optionalKey<Schema.Literal<"approximate">>;
|
|
381
|
+
readonly country: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
382
|
+
readonly region: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
383
|
+
readonly city: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
384
|
+
readonly timezone: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
385
|
+
}>, Schema.Null]>>;
|
|
386
|
+
readonly search_context_size: Schema.optionalKey<Schema.Literals<readonly ["low", "medium", "high"]>>;
|
|
387
|
+
}>;
|
|
388
|
+
readonly parameters: Schema.Struct<{
|
|
389
|
+
readonly action: Schema.Union<readonly [Schema.Struct<{
|
|
390
|
+
readonly type: Schema.Literal<"search">;
|
|
391
|
+
readonly query: Schema.optionalKey<Schema.String>;
|
|
392
|
+
readonly queries: Schema.optionalKey<Schema.Array$<Schema.String>>;
|
|
393
|
+
readonly sources: Schema.optionalKey<Schema.Array$<Schema.Struct<{
|
|
394
|
+
readonly type: Schema.Literal<"url">;
|
|
395
|
+
readonly url: Schema.String;
|
|
396
|
+
}>>>;
|
|
397
|
+
}>, Schema.Struct<{
|
|
398
|
+
readonly type: Schema.Literal<"open_page">;
|
|
399
|
+
readonly url: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
400
|
+
}>, Schema.Struct<{
|
|
401
|
+
readonly type: Schema.Literal<"find_in_page">;
|
|
402
|
+
readonly url: Schema.String;
|
|
403
|
+
readonly pattern: Schema.String;
|
|
404
|
+
}>]>;
|
|
405
|
+
}>;
|
|
406
|
+
readonly success: Schema.Struct<{
|
|
407
|
+
readonly action: Schema.Union<readonly [Schema.Struct<{
|
|
408
|
+
readonly type: Schema.Literal<"search">;
|
|
409
|
+
readonly query: Schema.optionalKey<Schema.String>;
|
|
410
|
+
readonly queries: Schema.optionalKey<Schema.Array$<Schema.String>>;
|
|
411
|
+
readonly sources: Schema.optionalKey<Schema.Array$<Schema.Struct<{
|
|
412
|
+
readonly type: Schema.Literal<"url">;
|
|
413
|
+
readonly url: Schema.String;
|
|
414
|
+
}>>>;
|
|
415
|
+
}>, Schema.Struct<{
|
|
416
|
+
readonly type: Schema.Literal<"open_page">;
|
|
417
|
+
readonly url: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
418
|
+
}>, Schema.Struct<{
|
|
419
|
+
readonly type: Schema.Literal<"find_in_page">;
|
|
420
|
+
readonly url: Schema.String;
|
|
421
|
+
readonly pattern: Schema.String;
|
|
422
|
+
}>]>;
|
|
423
|
+
readonly status: Schema.Literals<readonly ["in_progress", "searching", "completed", "failed"]>;
|
|
424
|
+
}>;
|
|
425
|
+
readonly failure: Schema.Never;
|
|
426
|
+
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
427
|
+
}, false>;
|
|
428
|
+
/**
|
|
429
|
+
* OpenAI Web Search Preview tool.
|
|
430
|
+
*
|
|
431
|
+
* Preview version of the web search tool with additional features.
|
|
432
|
+
*
|
|
433
|
+
* @since 1.0.0
|
|
434
|
+
* @category tools
|
|
435
|
+
*/
|
|
436
|
+
export declare const WebSearchPreview: <Mode extends Tool.FailureMode | undefined = undefined>(args: {
|
|
437
|
+
readonly user_location?: {
|
|
438
|
+
readonly type: "approximate";
|
|
439
|
+
readonly country?: string | null;
|
|
440
|
+
readonly region?: string | null;
|
|
441
|
+
readonly city?: string | null;
|
|
442
|
+
readonly timezone?: string | null;
|
|
443
|
+
} | null;
|
|
444
|
+
readonly search_context_size?: "low" | "high" | "medium";
|
|
445
|
+
}) => Tool.ProviderDefined<"openai.web_search_preview", "OpenAiWebSearchPreview", {
|
|
446
|
+
readonly args: Schema.Struct<{
|
|
447
|
+
readonly user_location: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
448
|
+
readonly type: Schema.Literal<"approximate">;
|
|
449
|
+
readonly country: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
450
|
+
readonly region: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
451
|
+
readonly city: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
452
|
+
readonly timezone: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
453
|
+
}>, Schema.Null]>>;
|
|
454
|
+
readonly search_context_size: Schema.optionalKey<Schema.Literals<readonly ["low", "medium", "high"]>>;
|
|
455
|
+
}>;
|
|
456
|
+
readonly parameters: Schema.Void;
|
|
457
|
+
readonly success: Schema.Struct<{
|
|
458
|
+
readonly action: Schema.Union<readonly [Schema.Struct<{
|
|
459
|
+
readonly type: Schema.Literal<"search">;
|
|
460
|
+
readonly query: Schema.optionalKey<Schema.String>;
|
|
461
|
+
readonly queries: Schema.optionalKey<Schema.Array$<Schema.String>>;
|
|
462
|
+
readonly sources: Schema.optionalKey<Schema.Array$<Schema.Struct<{
|
|
463
|
+
readonly type: Schema.Literal<"url">;
|
|
464
|
+
readonly url: Schema.String;
|
|
465
|
+
}>>>;
|
|
466
|
+
}>, Schema.Struct<{
|
|
467
|
+
readonly type: Schema.Literal<"open_page">;
|
|
468
|
+
readonly url: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
|
|
469
|
+
}>, Schema.Struct<{
|
|
470
|
+
readonly type: Schema.Literal<"find_in_page">;
|
|
471
|
+
readonly url: Schema.String;
|
|
472
|
+
readonly pattern: Schema.String;
|
|
473
|
+
}>]>;
|
|
474
|
+
readonly status: Schema.Literals<readonly ["in_progress", "searching", "completed", "failed"]>;
|
|
475
|
+
}>;
|
|
476
|
+
readonly failure: Schema.Never;
|
|
477
|
+
readonly failureMode: Mode extends undefined ? "error" : Mode;
|
|
478
|
+
}, false>;
|
|
479
|
+
//# sourceMappingURL=OpenAiTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenAiTool.d.ts","sourceRoot":"","sources":["../src/OpenAiTool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;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;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;QAarB,CAAA;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAc1B,CAAA;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAerB,CAAA;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAmB1B,CAAA;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;QAWrB,CAAA;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAqBd,CAAA;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;QAWhB,CAAA;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAgBpB,CAAA;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAY3B,CAAA"}
|