WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 00dfa76

Browse files
feat(provider/google-vertex): Add support for the imageSize provider option (#10651)
## Background New sampleImageSize option for Google Vertex provider with Imagen: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#sample_image_size_rest ## Summary Added the option in the vertex providerOptions and updated related test
1 parent 482b947 commit 00dfa76

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

.changeset/healthy-donuts-stare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@ai-sdk/google-vertex': patch
3+
---
4+
5+
feat(provider/google-vertex): Add support for the imageSize provider option

packages/google-vertex/src/google-vertex-image-model.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createTestServer } from '@ai-sdk/test-server/with-vitest';
2+
import { describe, expect, it, vi } from 'vitest';
23
import { GoogleVertexImageModel } from './google-vertex-image-model';
34
import { createVertex } from './google-vertex-provider';
4-
import { describe, it, expect, vi } from 'vitest';
55

66
vi.mock('./version', () => ({
77
VERSION: '0.0.0-test',
@@ -308,6 +308,7 @@ describe('GoogleVertexImageModel', () => {
308308
addWatermark: false,
309309
negativePrompt: 'negative prompt',
310310
personGeneration: 'allow_all',
311+
sampleImageSize: '2K',
311312
foo: 'bar',
312313
},
313314
},
@@ -321,6 +322,7 @@ describe('GoogleVertexImageModel', () => {
321322
negativePrompt: 'negative prompt',
322323
personGeneration: 'allow_all',
323324
aspectRatio: '16:9',
325+
sampleImageSize: '2K',
324326
},
325327
});
326328
});

packages/google-vertex/src/google-vertex-image-model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ const vertexImageProviderOptionsSchema = z.object({
145145
.nullish(),
146146
addWatermark: z.boolean().nullish(),
147147
storageUri: z.string().nullish(),
148+
sampleImageSize: z.enum(['1K', '2K']).nullish(),
148149
});
149150
export type GoogleVertexImageProviderOptions = z.infer<
150151
typeof vertexImageProviderOptionsSchema

0 commit comments

Comments
 (0)