@ai-sdk/openai 3.0.68 → 3.0.69

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/index.mjs CHANGED
@@ -4583,20 +4583,37 @@ async function prepareResponsesTools({
4583
4583
  return { tools: void 0, toolChoice: void 0, toolWarnings };
4584
4584
  }
4585
4585
  const openaiTools2 = [];
4586
+ const namespaceTools = /* @__PURE__ */ new Map();
4586
4587
  const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
4587
4588
  for (const tool of tools) {
4588
4589
  switch (tool.type) {
4589
4590
  case "function": {
4590
4591
  const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
4591
- const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
4592
- openaiTools2.push({
4593
- type: "function",
4594
- name: tool.name,
4595
- description: tool.description,
4596
- parameters: tool.inputSchema,
4597
- ...tool.strict != null ? { strict: tool.strict } : {},
4598
- ...deferLoading != null ? { defer_loading: deferLoading } : {}
4592
+ const openaiFunctionTool = prepareFunctionTool({
4593
+ tool,
4594
+ options: openaiOptions
4599
4595
  });
4596
+ const namespace = openaiOptions == null ? void 0 : openaiOptions.namespace;
4597
+ if (namespace == null) {
4598
+ openaiTools2.push(openaiFunctionTool);
4599
+ } else {
4600
+ let namespaceTool = namespaceTools.get(namespace.name);
4601
+ if (namespaceTool == null) {
4602
+ namespaceTool = {
4603
+ type: "namespace",
4604
+ name: namespace.name,
4605
+ description: namespace.description,
4606
+ tools: []
4607
+ };
4608
+ namespaceTools.set(namespace.name, namespaceTool);
4609
+ openaiTools2.push(namespaceTool);
4610
+ } else if (namespaceTool.description !== namespace.description) {
4611
+ throw new UnsupportedFunctionalityError5({
4612
+ functionality: `conflicting descriptions for OpenAI tool namespace "${namespace.name}"`
4613
+ });
4614
+ }
4615
+ namespaceTool.tools.push(openaiFunctionTool);
4616
+ }
4600
4617
  break;
4601
4618
  }
4602
4619
  case "provider": {
@@ -4809,6 +4826,20 @@ async function prepareResponsesTools({
4809
4826
  }
4810
4827
  }
4811
4828
  }
4829
+ function prepareFunctionTool({
4830
+ tool,
4831
+ options
4832
+ }) {
4833
+ const deferLoading = options == null ? void 0 : options.deferLoading;
4834
+ return {
4835
+ type: "function",
4836
+ name: tool.name,
4837
+ description: tool.description,
4838
+ parameters: tool.inputSchema,
4839
+ ...tool.strict != null ? { strict: tool.strict } : {},
4840
+ ...deferLoading != null ? { defer_loading: deferLoading } : {}
4841
+ };
4842
+ }
4812
4843
  function mapShellEnvironment(environment) {
4813
4844
  if (environment.type === "containerReference") {
4814
4845
  const env2 = environment;
@@ -6936,7 +6967,7 @@ var OpenAITranscriptionModel = class {
6936
6967
  };
6937
6968
 
6938
6969
  // src/version.ts
6939
- var VERSION = true ? "3.0.68" : "0.0.0-test";
6970
+ var VERSION = true ? "3.0.69" : "0.0.0-test";
6940
6971
 
6941
6972
  // src/openai-provider.ts
6942
6973
  function createOpenAI(options = {}) {