@ai-sdk/provider 3.0.0-beta.7 → 3.0.0-beta.8

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,11 @@
1
1
  # @ai-sdk/provider
2
2
 
3
+ ## 3.0.0-beta.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 3794514: feat: flexible tool output content support
8
+
3
9
  ## 3.0.0-beta.7
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1020,11 +1020,22 @@ interface LanguageModelV3ToolResultPart {
1020
1020
  * Result of a tool call.
1021
1021
  */
1022
1022
  type LanguageModelV3ToolResultOutput = {
1023
+ /**
1024
+ * Text tool output that should be directly sent to the API.
1025
+ */
1023
1026
  type: 'text';
1024
1027
  value: string;
1028
+ /**
1029
+ * Provider-specific options.
1030
+ */
1031
+ providerOptions?: SharedV3ProviderOptions;
1025
1032
  } | {
1026
1033
  type: 'json';
1027
1034
  value: JSONValue;
1035
+ /**
1036
+ * Provider-specific options.
1037
+ */
1038
+ providerOptions?: SharedV3ProviderOptions;
1028
1039
  } | {
1029
1040
  /**
1030
1041
  * Type when the user has denied the execution of the tool call.
@@ -1034,12 +1045,24 @@ type LanguageModelV3ToolResultOutput = {
1034
1045
  * Optional reason for the execution denial.
1035
1046
  */
1036
1047
  reason?: string;
1048
+ /**
1049
+ * Provider-specific options.
1050
+ */
1051
+ providerOptions?: SharedV3ProviderOptions;
1037
1052
  } | {
1038
1053
  type: 'error-text';
1039
1054
  value: string;
1055
+ /**
1056
+ * Provider-specific options.
1057
+ */
1058
+ providerOptions?: SharedV3ProviderOptions;
1040
1059
  } | {
1041
1060
  type: 'error-json';
1042
1061
  value: JSONValue;
1062
+ /**
1063
+ * Provider-specific options.
1064
+ */
1065
+ providerOptions?: SharedV3ProviderOptions;
1043
1066
  } | {
1044
1067
  type: 'content';
1045
1068
  value: Array<{
@@ -1048,8 +1071,12 @@ type LanguageModelV3ToolResultOutput = {
1048
1071
  Text content.
1049
1072
  */
1050
1073
  text: string;
1074
+ /**
1075
+ * Provider-specific options.
1076
+ */
1077
+ providerOptions?: SharedV3ProviderOptions;
1051
1078
  } | {
1052
- type: 'media';
1079
+ type: 'file-data';
1053
1080
  /**
1054
1081
  Base-64 encoded media data.
1055
1082
  */
@@ -1059,6 +1086,98 @@ IANA media type.
1059
1086
  @see https://www.iana.org/assignments/media-types/media-types.xhtml
1060
1087
  */
1061
1088
  mediaType: string;
1089
+ /**
1090
+ * Optional filename of the file.
1091
+ */
1092
+ filename?: string;
1093
+ /**
1094
+ * Provider-specific options.
1095
+ */
1096
+ providerOptions?: SharedV3ProviderOptions;
1097
+ } | {
1098
+ type: 'file-url';
1099
+ /**
1100
+ * URL of the file.
1101
+ */
1102
+ url: string;
1103
+ /**
1104
+ * Provider-specific options.
1105
+ */
1106
+ providerOptions?: SharedV3ProviderOptions;
1107
+ } | {
1108
+ type: 'file-id';
1109
+ /**
1110
+ * ID of the file.
1111
+ *
1112
+ * If you use multiple providers, you need to
1113
+ * specify the provider specific ids using
1114
+ * the Record option. The key is the provider
1115
+ * name, e.g. 'openai' or 'anthropic'.
1116
+ */
1117
+ fileId: string | Record<string, string>;
1118
+ /**
1119
+ * Provider-specific options.
1120
+ */
1121
+ providerOptions?: SharedV3ProviderOptions;
1122
+ } | {
1123
+ /**
1124
+ * Images that are referenced using base64 encoded data.
1125
+ */
1126
+ type: 'image-data';
1127
+ /**
1128
+ Base-64 encoded image data.
1129
+ */
1130
+ data: string;
1131
+ /**
1132
+ IANA media type.
1133
+ @see https://www.iana.org/assignments/media-types/media-types.xhtml
1134
+ */
1135
+ mediaType: string;
1136
+ /**
1137
+ * Provider-specific options.
1138
+ */
1139
+ providerOptions?: SharedV3ProviderOptions;
1140
+ } | {
1141
+ /**
1142
+ * Images that are referenced using a URL.
1143
+ */
1144
+ type: 'image-url';
1145
+ /**
1146
+ * URL of the image.
1147
+ */
1148
+ url: string;
1149
+ /**
1150
+ * Provider-specific options.
1151
+ */
1152
+ providerOptions?: SharedV3ProviderOptions;
1153
+ } | {
1154
+ /**
1155
+ * Images that are referenced using a provider file id.
1156
+ */
1157
+ type: 'image-file-id';
1158
+ /**
1159
+ * Image that is referenced using a provider file id.
1160
+ *
1161
+ * If you use multiple providers, you need to
1162
+ * specify the provider specific ids using
1163
+ * the Record option. The key is the provider
1164
+ * name, e.g. 'openai' or 'anthropic'.
1165
+ */
1166
+ fileId: string | Record<string, string>;
1167
+ /**
1168
+ * Provider-specific options.
1169
+ */
1170
+ providerOptions?: SharedV3ProviderOptions;
1171
+ } | {
1172
+ /**
1173
+ * Custom content part. This can be used to implement
1174
+ * provider-specific content parts.
1175
+ */
1176
+ type: 'custom';
1177
+ /**
1178
+ * Provider-specific options.
1179
+ */
1180
+ providerOptions?: SharedV3ProviderOptions;
1062
1181
  }>;
1063
1182
  };
1064
1183
 
package/dist/index.d.ts CHANGED
@@ -1020,11 +1020,22 @@ interface LanguageModelV3ToolResultPart {
1020
1020
  * Result of a tool call.
1021
1021
  */
1022
1022
  type LanguageModelV3ToolResultOutput = {
1023
+ /**
1024
+ * Text tool output that should be directly sent to the API.
1025
+ */
1023
1026
  type: 'text';
1024
1027
  value: string;
1028
+ /**
1029
+ * Provider-specific options.
1030
+ */
1031
+ providerOptions?: SharedV3ProviderOptions;
1025
1032
  } | {
1026
1033
  type: 'json';
1027
1034
  value: JSONValue;
1035
+ /**
1036
+ * Provider-specific options.
1037
+ */
1038
+ providerOptions?: SharedV3ProviderOptions;
1028
1039
  } | {
1029
1040
  /**
1030
1041
  * Type when the user has denied the execution of the tool call.
@@ -1034,12 +1045,24 @@ type LanguageModelV3ToolResultOutput = {
1034
1045
  * Optional reason for the execution denial.
1035
1046
  */
1036
1047
  reason?: string;
1048
+ /**
1049
+ * Provider-specific options.
1050
+ */
1051
+ providerOptions?: SharedV3ProviderOptions;
1037
1052
  } | {
1038
1053
  type: 'error-text';
1039
1054
  value: string;
1055
+ /**
1056
+ * Provider-specific options.
1057
+ */
1058
+ providerOptions?: SharedV3ProviderOptions;
1040
1059
  } | {
1041
1060
  type: 'error-json';
1042
1061
  value: JSONValue;
1062
+ /**
1063
+ * Provider-specific options.
1064
+ */
1065
+ providerOptions?: SharedV3ProviderOptions;
1043
1066
  } | {
1044
1067
  type: 'content';
1045
1068
  value: Array<{
@@ -1048,8 +1071,12 @@ type LanguageModelV3ToolResultOutput = {
1048
1071
  Text content.
1049
1072
  */
1050
1073
  text: string;
1074
+ /**
1075
+ * Provider-specific options.
1076
+ */
1077
+ providerOptions?: SharedV3ProviderOptions;
1051
1078
  } | {
1052
- type: 'media';
1079
+ type: 'file-data';
1053
1080
  /**
1054
1081
  Base-64 encoded media data.
1055
1082
  */
@@ -1059,6 +1086,98 @@ IANA media type.
1059
1086
  @see https://www.iana.org/assignments/media-types/media-types.xhtml
1060
1087
  */
1061
1088
  mediaType: string;
1089
+ /**
1090
+ * Optional filename of the file.
1091
+ */
1092
+ filename?: string;
1093
+ /**
1094
+ * Provider-specific options.
1095
+ */
1096
+ providerOptions?: SharedV3ProviderOptions;
1097
+ } | {
1098
+ type: 'file-url';
1099
+ /**
1100
+ * URL of the file.
1101
+ */
1102
+ url: string;
1103
+ /**
1104
+ * Provider-specific options.
1105
+ */
1106
+ providerOptions?: SharedV3ProviderOptions;
1107
+ } | {
1108
+ type: 'file-id';
1109
+ /**
1110
+ * ID of the file.
1111
+ *
1112
+ * If you use multiple providers, you need to
1113
+ * specify the provider specific ids using
1114
+ * the Record option. The key is the provider
1115
+ * name, e.g. 'openai' or 'anthropic'.
1116
+ */
1117
+ fileId: string | Record<string, string>;
1118
+ /**
1119
+ * Provider-specific options.
1120
+ */
1121
+ providerOptions?: SharedV3ProviderOptions;
1122
+ } | {
1123
+ /**
1124
+ * Images that are referenced using base64 encoded data.
1125
+ */
1126
+ type: 'image-data';
1127
+ /**
1128
+ Base-64 encoded image data.
1129
+ */
1130
+ data: string;
1131
+ /**
1132
+ IANA media type.
1133
+ @see https://www.iana.org/assignments/media-types/media-types.xhtml
1134
+ */
1135
+ mediaType: string;
1136
+ /**
1137
+ * Provider-specific options.
1138
+ */
1139
+ providerOptions?: SharedV3ProviderOptions;
1140
+ } | {
1141
+ /**
1142
+ * Images that are referenced using a URL.
1143
+ */
1144
+ type: 'image-url';
1145
+ /**
1146
+ * URL of the image.
1147
+ */
1148
+ url: string;
1149
+ /**
1150
+ * Provider-specific options.
1151
+ */
1152
+ providerOptions?: SharedV3ProviderOptions;
1153
+ } | {
1154
+ /**
1155
+ * Images that are referenced using a provider file id.
1156
+ */
1157
+ type: 'image-file-id';
1158
+ /**
1159
+ * Image that is referenced using a provider file id.
1160
+ *
1161
+ * If you use multiple providers, you need to
1162
+ * specify the provider specific ids using
1163
+ * the Record option. The key is the provider
1164
+ * name, e.g. 'openai' or 'anthropic'.
1165
+ */
1166
+ fileId: string | Record<string, string>;
1167
+ /**
1168
+ * Provider-specific options.
1169
+ */
1170
+ providerOptions?: SharedV3ProviderOptions;
1171
+ } | {
1172
+ /**
1173
+ * Custom content part. This can be used to implement
1174
+ * provider-specific content parts.
1175
+ */
1176
+ type: 'custom';
1177
+ /**
1178
+ * Provider-specific options.
1179
+ */
1180
+ providerOptions?: SharedV3ProviderOptions;
1062
1181
  }>;
1063
1182
  };
1064
1183
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/provider",
3
- "version": "3.0.0-beta.7",
3
+ "version": "3.0.0-beta.8",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",