@ai-sdk/google 4.0.0-canary.50 → 4.0.0-canary.51
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 +9 -0
- package/dist/index.js +23 -19
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +22 -18
- package/dist/internal/index.js.map +1 -1
- package/package.json +3 -3
- package/src/convert-to-google-messages.ts +36 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 4.0.0-canary.51
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5463d0d: feat(provider): align tool result output content file part types with top-level message file part types
|
|
8
|
+
- Updated dependencies [5463d0d]
|
|
9
|
+
- @ai-sdk/provider-utils@5.0.0-canary.32
|
|
10
|
+
- @ai-sdk/provider@4.0.0-canary.16
|
|
11
|
+
|
|
3
12
|
## 4.0.0-canary.50
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "4.0.0-canary.
|
|
10
|
+
var VERSION = true ? "4.0.0-canary.51" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -425,6 +425,7 @@ import {
|
|
|
425
425
|
} from "@ai-sdk/provider";
|
|
426
426
|
import {
|
|
427
427
|
convertToBase64,
|
|
428
|
+
getTopLevelMediaType,
|
|
428
429
|
isFullMediaType,
|
|
429
430
|
resolveFullMediaType,
|
|
430
431
|
resolveProviderReference
|
|
@@ -461,21 +462,23 @@ function appendToolResultParts(parts, toolName, outputValue) {
|
|
|
461
462
|
responseTextParts.push(contentPart.text);
|
|
462
463
|
break;
|
|
463
464
|
}
|
|
464
|
-
case "file
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
465
|
+
case "file": {
|
|
466
|
+
if (contentPart.data.type === "data") {
|
|
467
|
+
functionResponseParts.push({
|
|
468
|
+
inlineData: {
|
|
469
|
+
mimeType: resolveFullMediaType({ part: contentPart }),
|
|
470
|
+
data: convertToBase64(contentPart.data.data)
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
} else if (contentPart.data.type === "url") {
|
|
474
|
+
const functionResponsePart = convertUrlToolResultPart(
|
|
475
|
+
contentPart.data.url.toString()
|
|
476
|
+
);
|
|
477
|
+
if (functionResponsePart != null) {
|
|
478
|
+
functionResponseParts.push(functionResponsePart);
|
|
479
|
+
} else {
|
|
480
|
+
responseTextParts.push(JSON.stringify(contentPart));
|
|
469
481
|
}
|
|
470
|
-
});
|
|
471
|
-
break;
|
|
472
|
-
}
|
|
473
|
-
case "file-url": {
|
|
474
|
-
const functionResponsePart = convertUrlToolResultPart(
|
|
475
|
-
contentPart.url
|
|
476
|
-
);
|
|
477
|
-
if (functionResponsePart != null) {
|
|
478
|
-
functionResponseParts.push(functionResponsePart);
|
|
479
482
|
} else {
|
|
480
483
|
responseTextParts.push(JSON.stringify(contentPart));
|
|
481
484
|
}
|
|
@@ -512,13 +515,13 @@ function appendLegacyToolResultParts(parts, toolName, outputValue) {
|
|
|
512
515
|
}
|
|
513
516
|
});
|
|
514
517
|
break;
|
|
515
|
-
case "file
|
|
516
|
-
if (contentPart.
|
|
518
|
+
case "file": {
|
|
519
|
+
if (contentPart.data.type === "data" && getTopLevelMediaType(contentPart.mediaType) === "image") {
|
|
517
520
|
parts.push(
|
|
518
521
|
{
|
|
519
522
|
inlineData: {
|
|
520
|
-
mimeType: contentPart
|
|
521
|
-
data: contentPart.data
|
|
523
|
+
mimeType: resolveFullMediaType({ part: contentPart }),
|
|
524
|
+
data: convertToBase64(contentPart.data.data)
|
|
522
525
|
}
|
|
523
526
|
},
|
|
524
527
|
{
|
|
@@ -529,6 +532,7 @@ function appendLegacyToolResultParts(parts, toolName, outputValue) {
|
|
|
529
532
|
parts.push({ text: JSON.stringify(contentPart) });
|
|
530
533
|
}
|
|
531
534
|
break;
|
|
535
|
+
}
|
|
532
536
|
default:
|
|
533
537
|
parts.push({ text: JSON.stringify(contentPart) });
|
|
534
538
|
break;
|