@ai-sdk/openai 4.0.0-canary.69 → 4.0.0-canary.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/CHANGELOG.md +6 -0
- package/dist/index.js +40 -9
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +39 -8
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +78 -0
- package/package.json +1 -1
- package/src/responses/openai-responses-api.ts +13 -5
- package/src/responses/openai-responses-prepare-tools.ts +64 -11
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -5194,20 +5194,37 @@ async function prepareResponsesTools({
|
|
|
5194
5194
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
5195
5195
|
}
|
|
5196
5196
|
const openaiTools2 = [];
|
|
5197
|
+
const namespaceTools = /* @__PURE__ */ new Map();
|
|
5197
5198
|
const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
|
|
5198
5199
|
for (const tool of tools) {
|
|
5199
5200
|
switch (tool.type) {
|
|
5200
5201
|
case "function": {
|
|
5201
5202
|
const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
|
|
5202
|
-
const
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
name: tool.name,
|
|
5206
|
-
description: tool.description,
|
|
5207
|
-
parameters: tool.inputSchema,
|
|
5208
|
-
...tool.strict != null ? { strict: tool.strict } : {},
|
|
5209
|
-
...deferLoading != null ? { defer_loading: deferLoading } : {}
|
|
5203
|
+
const openaiFunctionTool = prepareFunctionTool({
|
|
5204
|
+
tool,
|
|
5205
|
+
options: openaiOptions
|
|
5210
5206
|
});
|
|
5207
|
+
const namespace = openaiOptions == null ? void 0 : openaiOptions.namespace;
|
|
5208
|
+
if (namespace == null) {
|
|
5209
|
+
openaiTools2.push(openaiFunctionTool);
|
|
5210
|
+
} else {
|
|
5211
|
+
let namespaceTool = namespaceTools.get(namespace.name);
|
|
5212
|
+
if (namespaceTool == null) {
|
|
5213
|
+
namespaceTool = {
|
|
5214
|
+
type: "namespace",
|
|
5215
|
+
name: namespace.name,
|
|
5216
|
+
description: namespace.description,
|
|
5217
|
+
tools: []
|
|
5218
|
+
};
|
|
5219
|
+
namespaceTools.set(namespace.name, namespaceTool);
|
|
5220
|
+
openaiTools2.push(namespaceTool);
|
|
5221
|
+
} else if (namespaceTool.description !== namespace.description) {
|
|
5222
|
+
throw new UnsupportedFunctionalityError5({
|
|
5223
|
+
functionality: `conflicting descriptions for OpenAI tool namespace "${namespace.name}"`
|
|
5224
|
+
});
|
|
5225
|
+
}
|
|
5226
|
+
namespaceTool.tools.push(openaiFunctionTool);
|
|
5227
|
+
}
|
|
5211
5228
|
break;
|
|
5212
5229
|
}
|
|
5213
5230
|
case "provider": {
|
|
@@ -5420,6 +5437,20 @@ async function prepareResponsesTools({
|
|
|
5420
5437
|
}
|
|
5421
5438
|
}
|
|
5422
5439
|
}
|
|
5440
|
+
function prepareFunctionTool({
|
|
5441
|
+
tool,
|
|
5442
|
+
options
|
|
5443
|
+
}) {
|
|
5444
|
+
const deferLoading = options == null ? void 0 : options.deferLoading;
|
|
5445
|
+
return {
|
|
5446
|
+
type: "function",
|
|
5447
|
+
name: tool.name,
|
|
5448
|
+
description: tool.description,
|
|
5449
|
+
parameters: tool.inputSchema,
|
|
5450
|
+
...tool.strict != null ? { strict: tool.strict } : {},
|
|
5451
|
+
...deferLoading != null ? { defer_loading: deferLoading } : {}
|
|
5452
|
+
};
|
|
5453
|
+
}
|
|
5423
5454
|
function mapShellEnvironment(environment) {
|
|
5424
5455
|
if (environment.type === "containerReference") {
|
|
5425
5456
|
const env2 = environment;
|
|
@@ -7711,7 +7742,7 @@ var OpenAISkills = class {
|
|
|
7711
7742
|
};
|
|
7712
7743
|
|
|
7713
7744
|
// src/version.ts
|
|
7714
|
-
var VERSION = true ? "4.0.0-canary.
|
|
7745
|
+
var VERSION = true ? "4.0.0-canary.70" : "0.0.0-test";
|
|
7715
7746
|
|
|
7716
7747
|
// src/openai-provider.ts
|
|
7717
7748
|
function createOpenAI(options = {}) {
|