@ai-sdk/provider-utils 5.0.58 → 5.0.60
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 +15 -0
- package/dist/experimental-decision/index.js +2 -1
- package/dist/experimental-decision/index.js.map +1 -1
- package/dist/experimental-evaluation/index.js +2 -1
- package/dist/experimental-evaluation/index.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/decision-language-model.ts +4 -1
- package/src/is-url-supported.ts +1 -2
- package/src/types/tool-approval-response.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/provider-utils",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.60",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@ai-sdk/provider": "4.0.
|
|
45
|
+
"@ai-sdk/provider": "4.0.27",
|
|
46
46
|
"@standard-schema/spec": "^1.1.0",
|
|
47
47
|
"@workflow/serde": "4.1.0",
|
|
48
48
|
"eventsource-parser": "^3.0.8",
|
|
@@ -220,7 +220,10 @@ export class DecisionLanguageModel implements DecisionModelV4 {
|
|
|
220
220
|
const value: unknown = (values as Record<string, unknown>)[`q${index}`];
|
|
221
221
|
if (question.type === 'choice') {
|
|
222
222
|
const options = Object.keys(question.criteria);
|
|
223
|
-
|
|
223
|
+
let choiceIndex = options.findIndex((_, i) => value === `c${i}`);
|
|
224
|
+
if (choiceIndex === -1 && typeof value === 'string') {
|
|
225
|
+
choiceIndex = options.indexOf(value);
|
|
226
|
+
}
|
|
224
227
|
if (choiceIndex === -1) {
|
|
225
228
|
throw new InvalidResponseDataError({
|
|
226
229
|
data: values,
|
package/src/is-url-supported.ts
CHANGED
|
@@ -20,8 +20,7 @@ export function isUrlSupported({
|
|
|
20
20
|
url: string;
|
|
21
21
|
supportedUrls: Record<string, RegExp[]>;
|
|
22
22
|
}): boolean {
|
|
23
|
-
// standardize media type
|
|
24
|
-
url = url.toLowerCase();
|
|
23
|
+
// standardize media type to lower case
|
|
25
24
|
mediaType = mediaType.toLowerCase();
|
|
26
25
|
|
|
27
26
|
const isTopLevelOnly = !mediaType.includes('/');
|
|
@@ -16,6 +16,13 @@ export type ToolApprovalResponse = {
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Optional reason for the approval or denial.
|
|
19
|
+
*
|
|
20
|
+
* For denied tool calls, the reason is included in the `execution-denied`
|
|
21
|
+
* tool result that is sent to the model. For approved tool calls that are
|
|
22
|
+
* executed by the SDK, the reason remains in the message history: it is not
|
|
23
|
+
* included in the model prompt and is not exposed through a dedicated tool
|
|
24
|
+
* execution option. For provider-executed tools, the approval response
|
|
25
|
+
* (including the reason) is forwarded to the provider.
|
|
19
26
|
*/
|
|
20
27
|
reason?: string;
|
|
21
28
|
|