@ai-sdk/provider-utils 5.0.0-canary.37 → 5.0.0-canary.39

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
+ ## 5.0.0-canary.39
4
+
5
+ ### Patch Changes
6
+
7
+ - 105f95b: Ensure the default empty tool input schema includes `type: "object"` for OpenAI-compatible providers that require object schemas.
8
+
9
+ ## 5.0.0-canary.38
10
+
11
+ ### Patch Changes
12
+
13
+ - ca446f8: feat: flexible tool descriptions
14
+
3
15
  ## 5.0.0-canary.37
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1513,10 +1513,19 @@ type BaseTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JS
1513
1513
  */
1514
1514
  type BaseFunctionTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any, CONTEXT extends Context | unknown | never = any> = BaseTool<INPUT, OUTPUT, CONTEXT> & {
1515
1515
  /**
1516
- * An optional description of what the tool does.
1517
- * Will be used by the language model to decide whether to use the tool.
1518
- */
1519
- description?: string;
1516
+ * Optional description of what the tool does.
1517
+ *
1518
+ * Included in the tool definition sent to the language model so it can
1519
+ * decide when and how to call the tool.
1520
+ *
1521
+ * Provide a string for a fixed description, or a function that returns a
1522
+ * string from the current `context` (and optional `sandbox`) when the
1523
+ * description should vary per call.
1524
+ */
1525
+ description?: string | ((options: {
1526
+ context: NoInfer<CONTEXT>;
1527
+ sandbox?: Sandbox;
1528
+ }) => string);
1520
1529
  /**
1521
1530
  * Strict mode setting for the tool.
1522
1531
  *
package/dist/index.js CHANGED
@@ -862,7 +862,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
862
862
  }
863
863
 
864
864
  // src/version.ts
865
- var VERSION = true ? "5.0.0-canary.37" : "0.0.0-test";
865
+ var VERSION = true ? "5.0.0-canary.39" : "0.0.0-test";
866
866
 
867
867
  // src/get-from-api.ts
868
868
  var getOriginalFetch = () => globalThis.fetch;
@@ -2481,7 +2481,11 @@ function isSchema(value) {
2481
2481
  return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true && "jsonSchema" in value && "validate" in value;
2482
2482
  }
2483
2483
  function asSchema(schema) {
2484
- return schema == null ? jsonSchema({ properties: {}, additionalProperties: false }) : isSchema(schema) ? schema : "~standard" in schema ? schema["~standard"].vendor === "zod" ? zodSchema(schema) : standardSchema(schema) : schema();
2484
+ return schema == null ? jsonSchema({
2485
+ type: "object",
2486
+ properties: {},
2487
+ additionalProperties: false
2488
+ }) : isSchema(schema) ? schema : "~standard" in schema ? schema["~standard"].vendor === "zod" ? zodSchema(schema) : standardSchema(schema) : schema();
2485
2489
  }
2486
2490
  function standardSchema(standardSchema2) {
2487
2491
  return jsonSchema(