@ai-sdk/provider-utils 4.0.0-beta.47 → 4.0.0-beta.49

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ai-sdk/provider-utils
2
2
 
3
+ ## 4.0.0-beta.49
4
+
5
+ ### Patch Changes
6
+
7
+ - 83e5744: feat: support async Tool.toModelOutput
8
+
9
+ ## 4.0.0-beta.48
10
+
11
+ ### Patch Changes
12
+
13
+ - 960ec8f: chore: change argument of toModelOutput to parameter object
14
+
3
15
  ## 4.0.0-beta.47
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -998,11 +998,13 @@ type Tool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONVa
998
998
  } & ToolExecutionOptions) => void | PromiseLike<void>;
999
999
  } & ToolOutputProperties<INPUT, OUTPUT> & {
1000
1000
  /**
1001
- Optional conversion function that maps the tool result to an output that can be used by the language model.
1002
-
1003
- If not provided, the tool result will be sent as a JSON object.
1004
- */
1005
- toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) => ToolResultOutput;
1001
+ * Optional conversion function that maps the tool result to an output that can be used by the language model.
1002
+ *
1003
+ * If not provided, the tool result will be sent as a JSON object.
1004
+ */
1005
+ toModelOutput?: (options: {
1006
+ output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>;
1007
+ }) => ToolResultOutput | PromiseLike<ToolResultOutput>;
1006
1008
  } & ({
1007
1009
  /**
1008
1010
  Tool with user-defined input and output schemas.
@@ -1052,7 +1054,14 @@ declare function dynamicTool(tool: {
1052
1054
  providerOptions?: ProviderOptions;
1053
1055
  inputSchema: FlexibleSchema<unknown>;
1054
1056
  execute: ToolExecuteFunction<unknown, unknown>;
1055
- toModelOutput?: (output: unknown) => ToolResultOutput;
1057
+ /**
1058
+ * Optional conversion function that maps the tool result to an output that can be used by the language model.
1059
+ *
1060
+ * If not provided, the tool result will be sent as a JSON object.
1061
+ */
1062
+ toModelOutput?: (options: {
1063
+ output: unknown;
1064
+ }) => ToolResultOutput | PromiseLike<ToolResultOutput>;
1056
1065
  /**
1057
1066
  * Whether the tool needs approval before it can be executed.
1058
1067
  */
package/dist/index.d.ts CHANGED
@@ -998,11 +998,13 @@ type Tool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONVa
998
998
  } & ToolExecutionOptions) => void | PromiseLike<void>;
999
999
  } & ToolOutputProperties<INPUT, OUTPUT> & {
1000
1000
  /**
1001
- Optional conversion function that maps the tool result to an output that can be used by the language model.
1002
-
1003
- If not provided, the tool result will be sent as a JSON object.
1004
- */
1005
- toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) => ToolResultOutput;
1001
+ * Optional conversion function that maps the tool result to an output that can be used by the language model.
1002
+ *
1003
+ * If not provided, the tool result will be sent as a JSON object.
1004
+ */
1005
+ toModelOutput?: (options: {
1006
+ output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>;
1007
+ }) => ToolResultOutput | PromiseLike<ToolResultOutput>;
1006
1008
  } & ({
1007
1009
  /**
1008
1010
  Tool with user-defined input and output schemas.
@@ -1052,7 +1054,14 @@ declare function dynamicTool(tool: {
1052
1054
  providerOptions?: ProviderOptions;
1053
1055
  inputSchema: FlexibleSchema<unknown>;
1054
1056
  execute: ToolExecuteFunction<unknown, unknown>;
1055
- toModelOutput?: (output: unknown) => ToolResultOutput;
1057
+ /**
1058
+ * Optional conversion function that maps the tool result to an output that can be used by the language model.
1059
+ *
1060
+ * If not provided, the tool result will be sent as a JSON object.
1061
+ */
1062
+ toModelOutput?: (options: {
1063
+ output: unknown;
1064
+ }) => ToolResultOutput | PromiseLike<ToolResultOutput>;
1056
1065
  /**
1057
1066
  * Whether the tool needs approval before it can be executed.
1058
1067
  */
package/dist/index.js CHANGED
@@ -378,7 +378,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
378
378
  }
379
379
 
380
380
  // src/version.ts
381
- var VERSION = true ? "4.0.0-beta.47" : "0.0.0-test";
381
+ var VERSION = true ? "4.0.0-beta.49" : "0.0.0-test";
382
382
 
383
383
  // src/get-from-api.ts
384
384
  var getOriginalFetch = () => globalThis.fetch;