@ai-sdk/google 4.0.15 → 4.0.17

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.
@@ -384,7 +384,7 @@ declare class GoogleInteractionsLanguageModel implements LanguageModelV4 {
384
384
  readonly modelId: string;
385
385
  /**
386
386
  * Optional agent name. When provided, the request body sends `agent:` instead
387
- * of `model:` and rejects `tools` / `generation_config` (warned, not thrown).
387
+ * of `model:` and rejects `generation_config` (warned, not thrown).
388
388
  */
389
389
  readonly agent: string | undefined;
390
390
  private readonly config;
@@ -754,7 +754,38 @@ var googleLanguageModelOptions = lazySchema2(
754
754
  "1:4",
755
755
  "4:1"
756
756
  ]).optional(),
757
- imageSize: z2.enum(["1K", "2K", "4K", "512"]).optional()
757
+ imageSize: z2.enum(["1K", "2K", "4K", "512"]).optional(),
758
+ /**
759
+ * Optional. Controls the generation of people in images.
760
+ * Vertex AI only.
761
+ */
762
+ personGeneration: z2.enum([
763
+ "PERSON_GENERATION_UNSPECIFIED",
764
+ "ALLOW_ALL",
765
+ "ALLOW_ADULT",
766
+ "ALLOW_NONE"
767
+ ]).optional(),
768
+ /**
769
+ * Optional. Controls whether generation of prominent people
770
+ * (celebrities) is allowed. When set together with
771
+ * `personGeneration`, `personGeneration` takes precedence.
772
+ * Vertex AI only.
773
+ *
774
+ * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
775
+ */
776
+ prominentPeople: z2.enum([
777
+ "PROMINENT_PEOPLE_UNSPECIFIED",
778
+ "ALLOW_PROMINENT_PEOPLE",
779
+ "BLOCK_PROMINENT_PEOPLE"
780
+ ]).optional(),
781
+ /**
782
+ * Optional. The image output format for generated images.
783
+ * Vertex AI only.
784
+ */
785
+ imageOutputOptions: z2.object({
786
+ mimeType: z2.enum(["image/jpeg", "image/png"]).optional(),
787
+ compressionQuality: z2.number().optional()
788
+ }).optional()
758
789
  }).optional(),
759
790
  /**
760
791
  * Optional. Configuration for grounding retrieval.
@@ -1431,6 +1462,27 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1431
1462
  }
1432
1463
  } : void 0;
1433
1464
  const bodyServiceTier = isVertexProvider ? void 0 : googleOptions == null ? void 0 : googleOptions.serviceTier;
1465
+ let imageConfig = googleOptions == null ? void 0 : googleOptions.imageConfig;
1466
+ if (imageConfig != null && !isVertexProvider) {
1467
+ const {
1468
+ personGeneration,
1469
+ prominentPeople,
1470
+ imageOutputOptions,
1471
+ ...geminiApiImageConfig
1472
+ } = imageConfig;
1473
+ const droppedImageConfigFields = Object.entries({
1474
+ personGeneration,
1475
+ prominentPeople,
1476
+ imageOutputOptions
1477
+ }).filter(([, value]) => value != null).map(([key]) => `'imageConfig.${key}'`);
1478
+ if (droppedImageConfigFields.length > 0) {
1479
+ warnings.push({
1480
+ type: "other",
1481
+ message: `${droppedImageConfigFields.join(", ")} ${droppedImageConfigFields.length === 1 ? "is a Vertex AI option and is" : "are Vertex AI options and are"} ignored with the current Google provider (${this.config.provider}).`
1482
+ });
1483
+ imageConfig = geminiApiImageConfig;
1484
+ }
1485
+ }
1434
1486
  const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
1435
1487
  const isGemini3Model2 = /^gemini-3[.-]/.test(this.modelId);
1436
1488
  const supportsFunctionResponseParts = isGemini3Model2;
@@ -1502,9 +1554,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1502
1554
  ...(googleOptions == null ? void 0 : googleOptions.mediaResolution) && {
1503
1555
  mediaResolution: googleOptions.mediaResolution
1504
1556
  },
1505
- ...(googleOptions == null ? void 0 : googleOptions.imageConfig) && {
1506
- imageConfig: googleOptions.imageConfig
1507
- }
1557
+ ...imageConfig && { imageConfig }
1508
1558
  },
1509
1559
  contents,
1510
1560
  systemInstruction: isGemmaModel ? void 0 : systemInstruction,
@@ -5383,12 +5433,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
5383
5433
  const hasTools = options.tools != null && options.tools.length > 0;
5384
5434
  let toolsForBody;
5385
5435
  let toolChoiceForBody;
5386
- if (hasTools && isAgent) {
5387
- warnings.push({
5388
- type: "other",
5389
- message: "google.interactions: tools are not supported when an agent is set; tools will be omitted from the request body."
5390
- });
5391
- } else if (hasTools) {
5436
+ if (hasTools) {
5392
5437
  const prepared = prepareGoogleInteractionsTools({
5393
5438
  tools: options.tools,
5394
5439
  toolChoice: options.toolChoice