ai 6.0.0-beta.135 → 6.0.0-beta.136
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.d.mts +9 -11
- package/dist/index.d.ts +9 -11
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -4754,10 +4754,10 @@ declare function simulateStreamingMiddleware(): LanguageModelMiddleware;
|
|
|
4754
4754
|
* property. The middleware serializes examples into the tool's description text.
|
|
4755
4755
|
*
|
|
4756
4756
|
* @param options - Configuration options for the middleware.
|
|
4757
|
-
* @param options.
|
|
4758
|
-
* @param options.
|
|
4757
|
+
* @param options.prefix - A prefix to prepend before the examples. Default: 'Input Examples:'
|
|
4758
|
+
* @param options.format - Optional custom formatter for each example.
|
|
4759
4759
|
* Receives the example object and its index. Default: JSON.stringify(example.input)
|
|
4760
|
-
* @param options.
|
|
4760
|
+
* @param options.remove - Whether to remove the inputExamples property
|
|
4761
4761
|
* after adding them to the description. Default: true
|
|
4762
4762
|
*
|
|
4763
4763
|
* @example
|
|
@@ -4766,30 +4766,28 @@ declare function simulateStreamingMiddleware(): LanguageModelMiddleware;
|
|
|
4766
4766
|
*
|
|
4767
4767
|
* const model = wrapLanguageModel({
|
|
4768
4768
|
* model: yourModel,
|
|
4769
|
-
* middleware: addToolInputExamplesMiddleware(
|
|
4770
|
-
* examplesPrefix: 'Input Examples:',
|
|
4771
|
-
* }),
|
|
4769
|
+
* middleware: addToolInputExamplesMiddleware(),
|
|
4772
4770
|
* });
|
|
4773
4771
|
* ```
|
|
4774
4772
|
*/
|
|
4775
|
-
declare function addToolInputExamplesMiddleware({
|
|
4773
|
+
declare function addToolInputExamplesMiddleware({ prefix, format, remove, }?: {
|
|
4776
4774
|
/**
|
|
4777
|
-
* A prefix
|
|
4775
|
+
* A prefix to prepend before the examples.
|
|
4778
4776
|
*/
|
|
4779
|
-
|
|
4777
|
+
prefix?: string;
|
|
4780
4778
|
/**
|
|
4781
4779
|
* Optional custom formatter for each example.
|
|
4782
4780
|
* Receives the example object and its index.
|
|
4783
4781
|
* Default: JSON.stringify(example.input)
|
|
4784
4782
|
*/
|
|
4785
|
-
|
|
4783
|
+
format?: (example: {
|
|
4786
4784
|
input: JSONObject;
|
|
4787
4785
|
}, index: number) => string;
|
|
4788
4786
|
/**
|
|
4789
4787
|
* Whether to remove the inputExamples property after adding them to the description.
|
|
4790
4788
|
* Default: true
|
|
4791
4789
|
*/
|
|
4792
|
-
|
|
4790
|
+
remove?: boolean;
|
|
4793
4791
|
}): LanguageModelMiddleware;
|
|
4794
4792
|
|
|
4795
4793
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -4754,10 +4754,10 @@ declare function simulateStreamingMiddleware(): LanguageModelMiddleware;
|
|
|
4754
4754
|
* property. The middleware serializes examples into the tool's description text.
|
|
4755
4755
|
*
|
|
4756
4756
|
* @param options - Configuration options for the middleware.
|
|
4757
|
-
* @param options.
|
|
4758
|
-
* @param options.
|
|
4757
|
+
* @param options.prefix - A prefix to prepend before the examples. Default: 'Input Examples:'
|
|
4758
|
+
* @param options.format - Optional custom formatter for each example.
|
|
4759
4759
|
* Receives the example object and its index. Default: JSON.stringify(example.input)
|
|
4760
|
-
* @param options.
|
|
4760
|
+
* @param options.remove - Whether to remove the inputExamples property
|
|
4761
4761
|
* after adding them to the description. Default: true
|
|
4762
4762
|
*
|
|
4763
4763
|
* @example
|
|
@@ -4766,30 +4766,28 @@ declare function simulateStreamingMiddleware(): LanguageModelMiddleware;
|
|
|
4766
4766
|
*
|
|
4767
4767
|
* const model = wrapLanguageModel({
|
|
4768
4768
|
* model: yourModel,
|
|
4769
|
-
* middleware: addToolInputExamplesMiddleware(
|
|
4770
|
-
* examplesPrefix: 'Input Examples:',
|
|
4771
|
-
* }),
|
|
4769
|
+
* middleware: addToolInputExamplesMiddleware(),
|
|
4772
4770
|
* });
|
|
4773
4771
|
* ```
|
|
4774
4772
|
*/
|
|
4775
|
-
declare function addToolInputExamplesMiddleware({
|
|
4773
|
+
declare function addToolInputExamplesMiddleware({ prefix, format, remove, }?: {
|
|
4776
4774
|
/**
|
|
4777
|
-
* A prefix
|
|
4775
|
+
* A prefix to prepend before the examples.
|
|
4778
4776
|
*/
|
|
4779
|
-
|
|
4777
|
+
prefix?: string;
|
|
4780
4778
|
/**
|
|
4781
4779
|
* Optional custom formatter for each example.
|
|
4782
4780
|
* Receives the example object and its index.
|
|
4783
4781
|
* Default: JSON.stringify(example.input)
|
|
4784
4782
|
*/
|
|
4785
|
-
|
|
4783
|
+
format?: (example: {
|
|
4786
4784
|
input: JSONObject;
|
|
4787
4785
|
}, index: number) => string;
|
|
4788
4786
|
/**
|
|
4789
4787
|
* Whether to remove the inputExamples property after adding them to the description.
|
|
4790
4788
|
* Default: true
|
|
4791
4789
|
*/
|
|
4792
|
-
|
|
4790
|
+
remove?: boolean;
|
|
4793
4791
|
}): LanguageModelMiddleware;
|
|
4794
4792
|
|
|
4795
4793
|
/**
|
package/dist/index.js
CHANGED
|
@@ -909,7 +909,7 @@ function detectMediaType({
|
|
|
909
909
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
910
910
|
|
|
911
911
|
// src/version.ts
|
|
912
|
-
var VERSION = true ? "6.0.0-beta.
|
|
912
|
+
var VERSION = true ? "6.0.0-beta.136" : "0.0.0-test";
|
|
913
913
|
|
|
914
914
|
// src/util/download/download.ts
|
|
915
915
|
var download = async ({ url }) => {
|
|
@@ -9948,10 +9948,10 @@ function defaultFormatExample(example) {
|
|
|
9948
9948
|
return JSON.stringify(example.input);
|
|
9949
9949
|
}
|
|
9950
9950
|
function addToolInputExamplesMiddleware({
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
}) {
|
|
9951
|
+
prefix = "Input Examples:",
|
|
9952
|
+
format = defaultFormatExample,
|
|
9953
|
+
remove = true
|
|
9954
|
+
} = {}) {
|
|
9955
9955
|
return {
|
|
9956
9956
|
specificationVersion: "v3",
|
|
9957
9957
|
transformParams: async ({ params }) => {
|
|
@@ -9964,8 +9964,8 @@ function addToolInputExamplesMiddleware({
|
|
|
9964
9964
|
if (tool2.type !== "function" || !((_a16 = tool2.inputExamples) == null ? void 0 : _a16.length)) {
|
|
9965
9965
|
return tool2;
|
|
9966
9966
|
}
|
|
9967
|
-
const formattedExamples = tool2.inputExamples.map((example, index) =>
|
|
9968
|
-
const examplesSection = `${
|
|
9967
|
+
const formattedExamples = tool2.inputExamples.map((example, index) => format(example, index)).join("\n");
|
|
9968
|
+
const examplesSection = `${prefix}
|
|
9969
9969
|
${formattedExamples}`;
|
|
9970
9970
|
const toolDescription = tool2.description ? `${tool2.description}
|
|
9971
9971
|
|
|
@@ -9973,7 +9973,7 @@ ${examplesSection}` : examplesSection;
|
|
|
9973
9973
|
return {
|
|
9974
9974
|
...tool2,
|
|
9975
9975
|
description: toolDescription,
|
|
9976
|
-
inputExamples:
|
|
9976
|
+
inputExamples: remove ? void 0 : tool2.inputExamples
|
|
9977
9977
|
};
|
|
9978
9978
|
});
|
|
9979
9979
|
return {
|