ai 6.0.0-beta.133 → 6.0.0-beta.135

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
@@ -813,7 +813,7 @@ import {
813
813
  } from "@ai-sdk/provider-utils";
814
814
 
815
815
  // src/version.ts
816
- var VERSION = true ? "6.0.0-beta.133" : "0.0.0-test";
816
+ var VERSION = true ? "6.0.0-beta.135" : "0.0.0-test";
817
817
 
818
818
  // src/util/download/download.ts
819
819
  var download = async ({ url }) => {
@@ -9900,6 +9900,47 @@ function simulateStreamingMiddleware() {
9900
9900
  };
9901
9901
  }
9902
9902
 
9903
+ // src/middleware/add-tool-input-examples-middleware.ts
9904
+ function defaultFormatExample(example) {
9905
+ return JSON.stringify(example.input);
9906
+ }
9907
+ function addToolInputExamplesMiddleware({
9908
+ examplesPrefix,
9909
+ formatExample = defaultFormatExample,
9910
+ removeInputExamples = true
9911
+ }) {
9912
+ return {
9913
+ specificationVersion: "v3",
9914
+ transformParams: async ({ params }) => {
9915
+ var _a15;
9916
+ if (!((_a15 = params.tools) == null ? void 0 : _a15.length)) {
9917
+ return params;
9918
+ }
9919
+ const transformedTools = params.tools.map((tool2) => {
9920
+ var _a16;
9921
+ if (tool2.type !== "function" || !((_a16 = tool2.inputExamples) == null ? void 0 : _a16.length)) {
9922
+ return tool2;
9923
+ }
9924
+ const formattedExamples = tool2.inputExamples.map((example, index) => formatExample(example, index)).join("\n");
9925
+ const examplesSection = `${examplesPrefix}
9926
+ ${formattedExamples}`;
9927
+ const toolDescription = tool2.description ? `${tool2.description}
9928
+
9929
+ ${examplesSection}` : examplesSection;
9930
+ return {
9931
+ ...tool2,
9932
+ description: toolDescription,
9933
+ inputExamples: removeInputExamples ? void 0 : tool2.inputExamples
9934
+ };
9935
+ });
9936
+ return {
9937
+ ...params,
9938
+ tools: transformedTools
9939
+ };
9940
+ }
9941
+ };
9942
+ }
9943
+
9903
9944
  // src/middleware/wrap-language-model.ts
9904
9945
  var wrapLanguageModel = ({
9905
9946
  model,
@@ -11289,6 +11330,7 @@ export {
11289
11330
  UI_MESSAGE_STREAM_HEADERS,
11290
11331
  UnsupportedFunctionalityError,
11291
11332
  UnsupportedModelVersionError,
11333
+ addToolInputExamplesMiddleware,
11292
11334
  asSchema5 as asSchema,
11293
11335
  assistantModelMessageSchema,
11294
11336
  callCompletionApi,