ai 3.3.31 → 3.3.33
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 +12 -0
- package/dist/index.d.mts +56 -2
- package/dist/index.d.ts +56 -2
- package/dist/index.js +94 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +94 -86
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/rsc/dist/index.d.ts +7 -1
- package/rsc/dist/rsc-server.d.mts +7 -1
- package/rsc/dist/rsc-server.mjs +82 -82
- package/rsc/dist/rsc-server.mjs.map +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# ai
|
2
2
|
|
3
|
+
## 3.3.33
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- cbddc83: fix (ai/core): filter out empty text parts
|
8
|
+
|
9
|
+
## 3.3.32
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- ce7a4af: feat (ai/core): support providerMetadata in functions
|
14
|
+
|
3
15
|
## 3.3.31
|
4
16
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
@@ -706,6 +706,12 @@ Optional telemetry configuration (experimental).
|
|
706
706
|
*/
|
707
707
|
experimental_telemetry?: TelemetrySettings;
|
708
708
|
/**
|
709
|
+
Additional provider-specific metadata. They are passed through
|
710
|
+
to the provider from the AI SDK and enable provider-specific
|
711
|
+
functionality that can be fully encapsulated in the provider.
|
712
|
+
*/
|
713
|
+
experimental_providerMetadata?: ProviderMetadata;
|
714
|
+
/**
|
709
715
|
* Internal. For test use only. May change without notice.
|
710
716
|
*/
|
711
717
|
_internal?: {
|
@@ -762,6 +768,12 @@ Optional telemetry configuration (experimental).
|
|
762
768
|
*/
|
763
769
|
experimental_telemetry?: TelemetrySettings;
|
764
770
|
/**
|
771
|
+
Additional provider-specific metadata. They are passed through
|
772
|
+
to the provider from the AI SDK and enable provider-specific
|
773
|
+
functionality that can be fully encapsulated in the provider.
|
774
|
+
*/
|
775
|
+
experimental_providerMetadata?: ProviderMetadata;
|
776
|
+
/**
|
765
777
|
* Internal. For test use only. May change without notice.
|
766
778
|
*/
|
767
779
|
_internal?: {
|
@@ -806,6 +818,12 @@ Optional telemetry configuration (experimental).
|
|
806
818
|
*/
|
807
819
|
experimental_telemetry?: TelemetrySettings;
|
808
820
|
/**
|
821
|
+
Additional provider-specific metadata. They are passed through
|
822
|
+
to the provider from the AI SDK and enable provider-specific
|
823
|
+
functionality that can be fully encapsulated in the provider.
|
824
|
+
*/
|
825
|
+
experimental_providerMetadata?: ProviderMetadata;
|
826
|
+
/**
|
809
827
|
* Internal. For test use only. May change without notice.
|
810
828
|
*/
|
811
829
|
_internal?: {
|
@@ -836,6 +854,12 @@ Optional telemetry configuration (experimental).
|
|
836
854
|
*/
|
837
855
|
experimental_telemetry?: TelemetrySettings;
|
838
856
|
/**
|
857
|
+
Additional provider-specific metadata. They are passed through
|
858
|
+
to the provider from the AI SDK and enable provider-specific
|
859
|
+
functionality that can be fully encapsulated in the provider.
|
860
|
+
*/
|
861
|
+
experimental_providerMetadata?: ProviderMetadata;
|
862
|
+
/**
|
839
863
|
* Internal. For test use only. May change without notice.
|
840
864
|
*/
|
841
865
|
_internal?: {
|
@@ -1033,6 +1057,12 @@ Optional telemetry configuration (experimental).
|
|
1033
1057
|
*/
|
1034
1058
|
experimental_telemetry?: TelemetrySettings;
|
1035
1059
|
/**
|
1060
|
+
Additional provider-specific metadata. They are passed through
|
1061
|
+
to the provider from the AI SDK and enable provider-specific
|
1062
|
+
functionality that can be fully encapsulated in the provider.
|
1063
|
+
*/
|
1064
|
+
experimental_providerMetadata?: ProviderMetadata;
|
1065
|
+
/**
|
1036
1066
|
Callback that is called when the LLM response and the final object validation are finished.
|
1037
1067
|
*/
|
1038
1068
|
onFinish?: OnFinishCallback<OBJECT>;
|
@@ -1094,6 +1124,12 @@ Optional telemetry configuration (experimental).
|
|
1094
1124
|
*/
|
1095
1125
|
experimental_telemetry?: TelemetrySettings;
|
1096
1126
|
/**
|
1127
|
+
Additional provider-specific metadata. They are passed through
|
1128
|
+
to the provider from the AI SDK and enable provider-specific
|
1129
|
+
functionality that can be fully encapsulated in the provider.
|
1130
|
+
*/
|
1131
|
+
experimental_providerMetadata?: ProviderMetadata;
|
1132
|
+
/**
|
1097
1133
|
Callback that is called when the LLM response and the final object validation are finished.
|
1098
1134
|
*/
|
1099
1135
|
onFinish?: OnFinishCallback<Array<ELEMENT>>;
|
@@ -1129,6 +1165,12 @@ Optional telemetry configuration (experimental).
|
|
1129
1165
|
*/
|
1130
1166
|
experimental_telemetry?: TelemetrySettings;
|
1131
1167
|
/**
|
1168
|
+
Additional provider-specific metadata. They are passed through
|
1169
|
+
to the provider from the AI SDK and enable provider-specific
|
1170
|
+
functionality that can be fully encapsulated in the provider.
|
1171
|
+
*/
|
1172
|
+
experimental_providerMetadata?: ProviderMetadata;
|
1173
|
+
/**
|
1132
1174
|
Callback that is called when the LLM response and the final object validation are finished.
|
1133
1175
|
*/
|
1134
1176
|
onFinish?: OnFinishCallback<JSONValue>;
|
@@ -1434,7 +1476,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
1434
1476
|
@returns
|
1435
1477
|
A result object that contains the generated text, the results of the tool calls, and additional information.
|
1436
1478
|
*/
|
1437
|
-
declare function generateText<TOOLS extends Record<string, CoreTool>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxAutomaticRoundtrips, maxToolRoundtrips, experimental_telemetry: telemetry, _internal: { generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
1479
|
+
declare function generateText<TOOLS extends Record<string, CoreTool>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxAutomaticRoundtrips, maxToolRoundtrips, experimental_telemetry: telemetry, experimental_providerMetadata: providerMetadata, _internal: { generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
1438
1480
|
/**
|
1439
1481
|
The language model to use.
|
1440
1482
|
*/
|
@@ -1469,6 +1511,12 @@ By default, it's set to 0, which will disable the feature.
|
|
1469
1511
|
*/
|
1470
1512
|
experimental_telemetry?: TelemetrySettings;
|
1471
1513
|
/**
|
1514
|
+
Additional provider-specific metadata. They are passed through
|
1515
|
+
to the provider from the AI SDK and enable provider-specific
|
1516
|
+
functionality that can be fully encapsulated in the provider.
|
1517
|
+
*/
|
1518
|
+
experimental_providerMetadata?: ProviderMetadata;
|
1519
|
+
/**
|
1472
1520
|
* Internal. For test use only. May change without notice.
|
1473
1521
|
*/
|
1474
1522
|
_internal?: {
|
@@ -1732,7 +1780,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
1732
1780
|
@return
|
1733
1781
|
A result object for accessing different stream types and additional information.
|
1734
1782
|
*/
|
1735
|
-
declare function streamText<TOOLS extends Record<string, CoreTool>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxToolRoundtrips, experimental_telemetry: telemetry, experimental_toolCallStreaming: toolCallStreaming, onChunk, onFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
1783
|
+
declare function streamText<TOOLS extends Record<string, CoreTool>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxToolRoundtrips, experimental_telemetry: telemetry, experimental_providerMetadata: providerMetadata, experimental_toolCallStreaming: toolCallStreaming, onChunk, onFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
1736
1784
|
/**
|
1737
1785
|
The language model to use.
|
1738
1786
|
*/
|
@@ -1763,6 +1811,12 @@ Optional telemetry configuration (experimental).
|
|
1763
1811
|
*/
|
1764
1812
|
experimental_telemetry?: TelemetrySettings;
|
1765
1813
|
/**
|
1814
|
+
Additional provider-specific metadata. They are passed through
|
1815
|
+
to the provider from the AI SDK and enable provider-specific
|
1816
|
+
functionality that can be fully encapsulated in the provider.
|
1817
|
+
*/
|
1818
|
+
experimental_providerMetadata?: ProviderMetadata;
|
1819
|
+
/**
|
1766
1820
|
Enable streaming of tool call deltas as they are generated. Disabled by default.
|
1767
1821
|
*/
|
1768
1822
|
experimental_toolCallStreaming?: boolean;
|
package/dist/index.d.ts
CHANGED
@@ -706,6 +706,12 @@ Optional telemetry configuration (experimental).
|
|
706
706
|
*/
|
707
707
|
experimental_telemetry?: TelemetrySettings;
|
708
708
|
/**
|
709
|
+
Additional provider-specific metadata. They are passed through
|
710
|
+
to the provider from the AI SDK and enable provider-specific
|
711
|
+
functionality that can be fully encapsulated in the provider.
|
712
|
+
*/
|
713
|
+
experimental_providerMetadata?: ProviderMetadata;
|
714
|
+
/**
|
709
715
|
* Internal. For test use only. May change without notice.
|
710
716
|
*/
|
711
717
|
_internal?: {
|
@@ -762,6 +768,12 @@ Optional telemetry configuration (experimental).
|
|
762
768
|
*/
|
763
769
|
experimental_telemetry?: TelemetrySettings;
|
764
770
|
/**
|
771
|
+
Additional provider-specific metadata. They are passed through
|
772
|
+
to the provider from the AI SDK and enable provider-specific
|
773
|
+
functionality that can be fully encapsulated in the provider.
|
774
|
+
*/
|
775
|
+
experimental_providerMetadata?: ProviderMetadata;
|
776
|
+
/**
|
765
777
|
* Internal. For test use only. May change without notice.
|
766
778
|
*/
|
767
779
|
_internal?: {
|
@@ -806,6 +818,12 @@ Optional telemetry configuration (experimental).
|
|
806
818
|
*/
|
807
819
|
experimental_telemetry?: TelemetrySettings;
|
808
820
|
/**
|
821
|
+
Additional provider-specific metadata. They are passed through
|
822
|
+
to the provider from the AI SDK and enable provider-specific
|
823
|
+
functionality that can be fully encapsulated in the provider.
|
824
|
+
*/
|
825
|
+
experimental_providerMetadata?: ProviderMetadata;
|
826
|
+
/**
|
809
827
|
* Internal. For test use only. May change without notice.
|
810
828
|
*/
|
811
829
|
_internal?: {
|
@@ -836,6 +854,12 @@ Optional telemetry configuration (experimental).
|
|
836
854
|
*/
|
837
855
|
experimental_telemetry?: TelemetrySettings;
|
838
856
|
/**
|
857
|
+
Additional provider-specific metadata. They are passed through
|
858
|
+
to the provider from the AI SDK and enable provider-specific
|
859
|
+
functionality that can be fully encapsulated in the provider.
|
860
|
+
*/
|
861
|
+
experimental_providerMetadata?: ProviderMetadata;
|
862
|
+
/**
|
839
863
|
* Internal. For test use only. May change without notice.
|
840
864
|
*/
|
841
865
|
_internal?: {
|
@@ -1033,6 +1057,12 @@ Optional telemetry configuration (experimental).
|
|
1033
1057
|
*/
|
1034
1058
|
experimental_telemetry?: TelemetrySettings;
|
1035
1059
|
/**
|
1060
|
+
Additional provider-specific metadata. They are passed through
|
1061
|
+
to the provider from the AI SDK and enable provider-specific
|
1062
|
+
functionality that can be fully encapsulated in the provider.
|
1063
|
+
*/
|
1064
|
+
experimental_providerMetadata?: ProviderMetadata;
|
1065
|
+
/**
|
1036
1066
|
Callback that is called when the LLM response and the final object validation are finished.
|
1037
1067
|
*/
|
1038
1068
|
onFinish?: OnFinishCallback<OBJECT>;
|
@@ -1094,6 +1124,12 @@ Optional telemetry configuration (experimental).
|
|
1094
1124
|
*/
|
1095
1125
|
experimental_telemetry?: TelemetrySettings;
|
1096
1126
|
/**
|
1127
|
+
Additional provider-specific metadata. They are passed through
|
1128
|
+
to the provider from the AI SDK and enable provider-specific
|
1129
|
+
functionality that can be fully encapsulated in the provider.
|
1130
|
+
*/
|
1131
|
+
experimental_providerMetadata?: ProviderMetadata;
|
1132
|
+
/**
|
1097
1133
|
Callback that is called when the LLM response and the final object validation are finished.
|
1098
1134
|
*/
|
1099
1135
|
onFinish?: OnFinishCallback<Array<ELEMENT>>;
|
@@ -1129,6 +1165,12 @@ Optional telemetry configuration (experimental).
|
|
1129
1165
|
*/
|
1130
1166
|
experimental_telemetry?: TelemetrySettings;
|
1131
1167
|
/**
|
1168
|
+
Additional provider-specific metadata. They are passed through
|
1169
|
+
to the provider from the AI SDK and enable provider-specific
|
1170
|
+
functionality that can be fully encapsulated in the provider.
|
1171
|
+
*/
|
1172
|
+
experimental_providerMetadata?: ProviderMetadata;
|
1173
|
+
/**
|
1132
1174
|
Callback that is called when the LLM response and the final object validation are finished.
|
1133
1175
|
*/
|
1134
1176
|
onFinish?: OnFinishCallback<JSONValue>;
|
@@ -1434,7 +1476,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
1434
1476
|
@returns
|
1435
1477
|
A result object that contains the generated text, the results of the tool calls, and additional information.
|
1436
1478
|
*/
|
1437
|
-
declare function generateText<TOOLS extends Record<string, CoreTool>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxAutomaticRoundtrips, maxToolRoundtrips, experimental_telemetry: telemetry, _internal: { generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
1479
|
+
declare function generateText<TOOLS extends Record<string, CoreTool>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxAutomaticRoundtrips, maxToolRoundtrips, experimental_telemetry: telemetry, experimental_providerMetadata: providerMetadata, _internal: { generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
1438
1480
|
/**
|
1439
1481
|
The language model to use.
|
1440
1482
|
*/
|
@@ -1469,6 +1511,12 @@ By default, it's set to 0, which will disable the feature.
|
|
1469
1511
|
*/
|
1470
1512
|
experimental_telemetry?: TelemetrySettings;
|
1471
1513
|
/**
|
1514
|
+
Additional provider-specific metadata. They are passed through
|
1515
|
+
to the provider from the AI SDK and enable provider-specific
|
1516
|
+
functionality that can be fully encapsulated in the provider.
|
1517
|
+
*/
|
1518
|
+
experimental_providerMetadata?: ProviderMetadata;
|
1519
|
+
/**
|
1472
1520
|
* Internal. For test use only. May change without notice.
|
1473
1521
|
*/
|
1474
1522
|
_internal?: {
|
@@ -1732,7 +1780,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
1732
1780
|
@return
|
1733
1781
|
A result object for accessing different stream types and additional information.
|
1734
1782
|
*/
|
1735
|
-
declare function streamText<TOOLS extends Record<string, CoreTool>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxToolRoundtrips, experimental_telemetry: telemetry, experimental_toolCallStreaming: toolCallStreaming, onChunk, onFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
1783
|
+
declare function streamText<TOOLS extends Record<string, CoreTool>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxToolRoundtrips, experimental_telemetry: telemetry, experimental_providerMetadata: providerMetadata, experimental_toolCallStreaming: toolCallStreaming, onChunk, onFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
1736
1784
|
/**
|
1737
1785
|
The language model to use.
|
1738
1786
|
*/
|
@@ -1763,6 +1811,12 @@ Optional telemetry configuration (experimental).
|
|
1763
1811
|
*/
|
1764
1812
|
experimental_telemetry?: TelemetrySettings;
|
1765
1813
|
/**
|
1814
|
+
Additional provider-specific metadata. They are passed through
|
1815
|
+
to the provider from the AI SDK and enable provider-specific
|
1816
|
+
functionality that can be fully encapsulated in the provider.
|
1817
|
+
*/
|
1818
|
+
experimental_providerMetadata?: ProviderMetadata;
|
1819
|
+
/**
|
1766
1820
|
Enable streaming of tool call deltas as they are generated. Disabled by default.
|
1767
1821
|
*/
|
1768
1822
|
experimental_toolCallStreaming?: boolean;
|
package/dist/index.js
CHANGED
@@ -945,100 +945,98 @@ function convertToLanguageModelMessage(message, downloadedImages) {
|
|
945
945
|
}
|
946
946
|
return {
|
947
947
|
role: "user",
|
948
|
-
content: message.content.map(
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
if (
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
};
|
976
|
-
}
|
948
|
+
content: message.content.map((part) => {
|
949
|
+
var _a11, _b, _c;
|
950
|
+
switch (part.type) {
|
951
|
+
case "text": {
|
952
|
+
return {
|
953
|
+
type: "text",
|
954
|
+
text: part.text,
|
955
|
+
providerMetadata: part.experimental_providerMetadata
|
956
|
+
};
|
957
|
+
}
|
958
|
+
case "image": {
|
959
|
+
if (part.image instanceof URL) {
|
960
|
+
if (downloadedImages == null) {
|
961
|
+
return {
|
962
|
+
type: "image",
|
963
|
+
image: part.image,
|
964
|
+
mimeType: part.mimeType,
|
965
|
+
providerMetadata: part.experimental_providerMetadata
|
966
|
+
};
|
967
|
+
} else {
|
968
|
+
const downloadedImage = downloadedImages[part.image.toString()];
|
969
|
+
return {
|
970
|
+
type: "image",
|
971
|
+
image: downloadedImage.data,
|
972
|
+
mimeType: (_a11 = part.mimeType) != null ? _a11 : downloadedImage.mimeType,
|
973
|
+
providerMetadata: part.experimental_providerMetadata
|
974
|
+
};
|
977
975
|
}
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
}
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
}
|
976
|
+
}
|
977
|
+
if (typeof part.image === "string") {
|
978
|
+
try {
|
979
|
+
const url = new URL(part.image);
|
980
|
+
switch (url.protocol) {
|
981
|
+
case "http:":
|
982
|
+
case "https:": {
|
983
|
+
if (downloadedImages == null) {
|
984
|
+
return {
|
985
|
+
type: "image",
|
986
|
+
image: url,
|
987
|
+
mimeType: part.mimeType,
|
988
|
+
providerMetadata: part.experimental_providerMetadata
|
989
|
+
};
|
990
|
+
} else {
|
991
|
+
const downloadedImage = downloadedImages[part.image];
|
992
|
+
return {
|
993
|
+
type: "image",
|
994
|
+
image: downloadedImage.data,
|
995
|
+
mimeType: (_b = part.mimeType) != null ? _b : downloadedImage.mimeType,
|
996
|
+
providerMetadata: part.experimental_providerMetadata
|
997
|
+
};
|
1000
998
|
}
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
return {
|
1009
|
-
type: "image",
|
1010
|
-
image: convertDataContentToUint8Array(base64Content),
|
1011
|
-
mimeType,
|
1012
|
-
providerMetadata: part.experimental_providerMetadata
|
1013
|
-
};
|
1014
|
-
} catch (error) {
|
1015
|
-
throw new Error(
|
1016
|
-
`Error processing data URL: ${(0, import_provider_utils3.getErrorMessage)(
|
1017
|
-
message
|
1018
|
-
)}`
|
1019
|
-
);
|
999
|
+
}
|
1000
|
+
case "data:": {
|
1001
|
+
try {
|
1002
|
+
const [header, base64Content] = part.image.split(",");
|
1003
|
+
const mimeType = header.split(";")[0].split(":")[1];
|
1004
|
+
if (mimeType == null || base64Content == null) {
|
1005
|
+
throw new Error("Invalid data URL format");
|
1020
1006
|
}
|
1021
|
-
|
1022
|
-
|
1007
|
+
return {
|
1008
|
+
type: "image",
|
1009
|
+
image: convertDataContentToUint8Array(base64Content),
|
1010
|
+
mimeType,
|
1011
|
+
providerMetadata: part.experimental_providerMetadata
|
1012
|
+
};
|
1013
|
+
} catch (error) {
|
1023
1014
|
throw new Error(
|
1024
|
-
`
|
1015
|
+
`Error processing data URL: ${(0, import_provider_utils3.getErrorMessage)(
|
1016
|
+
message
|
1017
|
+
)}`
|
1025
1018
|
);
|
1026
1019
|
}
|
1027
1020
|
}
|
1028
|
-
|
1021
|
+
default: {
|
1022
|
+
throw new Error(
|
1023
|
+
`Unsupported URL protocol: ${url.protocol}`
|
1024
|
+
);
|
1025
|
+
}
|
1029
1026
|
}
|
1027
|
+
} catch (_ignored) {
|
1030
1028
|
}
|
1031
|
-
const imageUint8 = convertDataContentToUint8Array(part.image);
|
1032
|
-
return {
|
1033
|
-
type: "image",
|
1034
|
-
image: imageUint8,
|
1035
|
-
mimeType: (_c = part.mimeType) != null ? _c : detectImageMimeType(imageUint8),
|
1036
|
-
providerMetadata: part.experimental_providerMetadata
|
1037
|
-
};
|
1038
1029
|
}
|
1030
|
+
const imageUint8 = convertDataContentToUint8Array(part.image);
|
1031
|
+
return {
|
1032
|
+
type: "image",
|
1033
|
+
image: imageUint8,
|
1034
|
+
mimeType: (_c = part.mimeType) != null ? _c : detectImageMimeType(imageUint8),
|
1035
|
+
providerMetadata: part.experimental_providerMetadata
|
1036
|
+
};
|
1039
1037
|
}
|
1040
1038
|
}
|
1041
|
-
),
|
1039
|
+
}).filter((part) => part.type !== "text" || part.text !== ""),
|
1042
1040
|
providerMetadata: message.experimental_providerMetadata
|
1043
1041
|
};
|
1044
1042
|
}
|
@@ -1852,6 +1850,7 @@ async function generateObject({
|
|
1852
1850
|
abortSignal,
|
1853
1851
|
headers,
|
1854
1852
|
experimental_telemetry: telemetry,
|
1853
|
+
experimental_providerMetadata: providerMetadata,
|
1855
1854
|
_internal: {
|
1856
1855
|
generateId: generateId3 = originalGenerateId,
|
1857
1856
|
currentDate = () => /* @__PURE__ */ new Date()
|
@@ -1916,7 +1915,7 @@ async function generateObject({
|
|
1916
1915
|
let rawResponse;
|
1917
1916
|
let response;
|
1918
1917
|
let logprobs;
|
1919
|
-
let
|
1918
|
+
let resultProviderMetadata;
|
1920
1919
|
switch (mode) {
|
1921
1920
|
case "json": {
|
1922
1921
|
const validatedPrompt = validatePrompt({
|
@@ -1974,6 +1973,7 @@ async function generateObject({
|
|
1974
1973
|
...prepareCallSettings(settings),
|
1975
1974
|
inputFormat,
|
1976
1975
|
prompt: promptMessages,
|
1976
|
+
providerMetadata,
|
1977
1977
|
abortSignal,
|
1978
1978
|
headers
|
1979
1979
|
});
|
@@ -2018,7 +2018,7 @@ async function generateObject({
|
|
2018
2018
|
warnings = generateResult.warnings;
|
2019
2019
|
rawResponse = generateResult.rawResponse;
|
2020
2020
|
logprobs = generateResult.logprobs;
|
2021
|
-
|
2021
|
+
resultProviderMetadata = generateResult.providerMetadata;
|
2022
2022
|
response = generateResult.responseData;
|
2023
2023
|
break;
|
2024
2024
|
}
|
@@ -2078,6 +2078,7 @@ async function generateObject({
|
|
2078
2078
|
...prepareCallSettings(settings),
|
2079
2079
|
inputFormat,
|
2080
2080
|
prompt: promptMessages,
|
2081
|
+
providerMetadata,
|
2081
2082
|
abortSignal,
|
2082
2083
|
headers
|
2083
2084
|
});
|
@@ -2123,7 +2124,7 @@ async function generateObject({
|
|
2123
2124
|
warnings = generateResult.warnings;
|
2124
2125
|
rawResponse = generateResult.rawResponse;
|
2125
2126
|
logprobs = generateResult.logprobs;
|
2126
|
-
|
2127
|
+
resultProviderMetadata = generateResult.providerMetadata;
|
2127
2128
|
response = generateResult.responseData;
|
2128
2129
|
break;
|
2129
2130
|
}
|
@@ -2175,7 +2176,7 @@ async function generateObject({
|
|
2175
2176
|
headers: rawResponse == null ? void 0 : rawResponse.headers
|
2176
2177
|
},
|
2177
2178
|
logprobs,
|
2178
|
-
providerMetadata
|
2179
|
+
providerMetadata: resultProviderMetadata
|
2179
2180
|
});
|
2180
2181
|
}
|
2181
2182
|
});
|
@@ -2333,6 +2334,7 @@ async function streamObject({
|
|
2333
2334
|
abortSignal,
|
2334
2335
|
headers,
|
2335
2336
|
experimental_telemetry: telemetry,
|
2337
|
+
experimental_providerMetadata: providerMetadata,
|
2336
2338
|
onFinish,
|
2337
2339
|
_internal: {
|
2338
2340
|
generateId: generateId3 = originalGenerateId2,
|
@@ -2413,6 +2415,7 @@ async function streamObject({
|
|
2413
2415
|
prompt: validatedPrompt,
|
2414
2416
|
modelSupportsImageUrls: model.supportsImageUrls
|
2415
2417
|
}),
|
2418
|
+
providerMetadata,
|
2416
2419
|
abortSignal,
|
2417
2420
|
headers
|
2418
2421
|
};
|
@@ -2454,6 +2457,7 @@ async function streamObject({
|
|
2454
2457
|
prompt: validatedPrompt,
|
2455
2458
|
modelSupportsImageUrls: model.supportsImageUrls
|
2456
2459
|
}),
|
2460
|
+
providerMetadata,
|
2457
2461
|
abortSignal,
|
2458
2462
|
headers
|
2459
2463
|
};
|
@@ -3016,6 +3020,7 @@ async function generateText({
|
|
3016
3020
|
maxAutomaticRoundtrips = 0,
|
3017
3021
|
maxToolRoundtrips = maxAutomaticRoundtrips,
|
3018
3022
|
experimental_telemetry: telemetry,
|
3023
|
+
experimental_providerMetadata: providerMetadata,
|
3019
3024
|
_internal: {
|
3020
3025
|
generateId: generateId3 = originalGenerateId3,
|
3021
3026
|
currentDate = () => /* @__PURE__ */ new Date()
|
@@ -3113,6 +3118,7 @@ async function generateText({
|
|
3113
3118
|
...callSettings,
|
3114
3119
|
inputFormat: currentInputFormat,
|
3115
3120
|
prompt: promptMessages,
|
3121
|
+
providerMetadata,
|
3116
3122
|
abortSignal,
|
3117
3123
|
headers
|
3118
3124
|
});
|
@@ -3684,6 +3690,7 @@ async function streamText({
|
|
3684
3690
|
headers,
|
3685
3691
|
maxToolRoundtrips = 0,
|
3686
3692
|
experimental_telemetry: telemetry,
|
3693
|
+
experimental_providerMetadata: providerMetadata,
|
3687
3694
|
experimental_toolCallStreaming: toolCallStreaming = false,
|
3688
3695
|
onChunk,
|
3689
3696
|
onFinish,
|
@@ -3770,6 +3777,7 @@ async function streamText({
|
|
3770
3777
|
...prepareCallSettings(settings),
|
3771
3778
|
inputFormat: promptType,
|
3772
3779
|
prompt: promptMessages2,
|
3780
|
+
providerMetadata,
|
3773
3781
|
abortSignal,
|
3774
3782
|
headers
|
3775
3783
|
})
|