@ai-sdk/google 4.0.26 → 4.0.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google",
3
- "version": "4.0.26",
3
+ "version": "4.0.27",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -103,7 +103,6 @@ export class GoogleFiles implements FilesV4 {
103
103
  const uploadResponse = await fetchFn(uploadUrl, {
104
104
  method: 'POST',
105
105
  headers: {
106
- 'Content-Length': String(fileBytes.length),
107
106
  'X-Goog-Upload-Offset': '0',
108
107
  'X-Goog-Upload-Command': 'upload, finalize',
109
108
  },
@@ -153,6 +153,21 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV4 {
153
153
 
154
154
  const isAgent = this.agent != null;
155
155
 
156
+ if (!isAgent) {
157
+ if (options.frequencyPenalty != null) {
158
+ warnings.push({
159
+ type: 'unsupported',
160
+ feature: 'frequencyPenalty',
161
+ });
162
+ }
163
+ if (options.presencePenalty != null) {
164
+ warnings.push({
165
+ type: 'unsupported',
166
+ feature: 'presencePenalty',
167
+ });
168
+ }
169
+ }
170
+
156
171
  const hasTools = options.tools != null && options.tools.length > 0;
157
172
 
158
173
  let toolsForBody: Array<GoogleInteractionsTool> | undefined;
@@ -276,6 +291,11 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV4 {
276
291
  const droppedFields: Array<string> = [];
277
292
  if (options.temperature != null) droppedFields.push('temperature');
278
293
  if (options.topP != null) droppedFields.push('topP');
294
+ if (options.topK != null) droppedFields.push('topK');
295
+ if (options.frequencyPenalty != null)
296
+ droppedFields.push('frequencyPenalty');
297
+ if (options.presencePenalty != null)
298
+ droppedFields.push('presencePenalty');
279
299
  if (options.seed != null) droppedFields.push('seed');
280
300
  if (options.stopSequences != null && options.stopSequences.length > 0) {
281
301
  droppedFields.push('stopSequences');
@@ -299,6 +319,7 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV4 {
299
319
  generationConfig = pruneUndefined({
300
320
  temperature: options.temperature ?? undefined,
301
321
  top_p: options.topP ?? undefined,
322
+ top_k: options.topK ?? undefined,
302
323
  seed: options.seed ?? undefined,
303
324
  stop_sequences:
304
325
  options.stopSequences != null && options.stopSequences.length > 0
@@ -461,6 +461,7 @@ export type GoogleInteractionsResponseFormatEntry =
461
461
  export type GoogleInteractionsGenerationConfig = {
462
462
  temperature?: number;
463
463
  top_p?: number;
464
+ top_k?: number;
464
465
  seed?: number;
465
466
  stop_sequences?: Array<string>;
466
467
  max_output_tokens?: number;