Skip to content

Commit 62ee307

Browse files
authored
feat(js/plugins/google-genai): support for veo-3.1-lite-generate-preview (#5038)
1 parent 1a1e3f8 commit 62ee307

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

  • js
    • plugins/google-genai/src/googleai
    • testapps/basic-gemini/src

js/plugins/google-genai/src/googleai/veo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ function commonRef(
120120
const GENERIC_MODEL = commonRef('veo');
121121

122122
const KNOWN_MODELS = {
123+
'veo-3.1-lite-generate-preview': commonRef('veo-3.1-lite-generate-preview'),
123124
'veo-3.1-generate-preview': commonRef('veo-3.1-generate-preview'),
124125
'veo-3.1-fast-generate-preview': commonRef('veo-3.1-fast-generate-preview'),
125126
'veo-3.0-generate-001': commonRef('veo-3.0-generate-001'),

js/testapps/basic-gemini/src/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -617,23 +617,23 @@ async function toWav(
617617

618618
// An example of using Ver 3 model to make a static photo move.
619619
ai.defineFlow('photo-move-veo', async (_, { sendChunk }) => {
620-
const startingImage = fs.readFileSync('photo.jpg', { encoding: 'base64' });
620+
const startingImage = fs.readFileSync('woman.png', { encoding: 'base64' });
621621

622622
let { operation } = await ai.generate({
623-
model: googleAI.model('veo-3.1-fast-generate-preview'),
623+
model: googleAI.model('veo-3.1-lite-generate-preview'),
624624
prompt: [
625625
{
626626
text: 'make the subject in the photo move',
627627
},
628628
{
629629
media: {
630-
contentType: 'image/jpeg',
631-
url: `data:image/jpeg;base64,${startingImage}`,
630+
contentType: 'image/png',
631+
url: `data:image/png;base64,${startingImage}`,
632632
},
633633
},
634634
],
635635
config: {
636-
resolution: '4k',
636+
resolution: '1080p',
637637
durationSeconds: 8,
638638
aspectRatio: '9:16',
639639
personGeneration: 'allow_adult',
@@ -659,6 +659,7 @@ ai.defineFlow('photo-move-veo', async (_, { sendChunk }) => {
659659
// operation done, download generated video to disk
660660
const video = operation.output?.message?.content.find((p) => !!p.media);
661661
if (!video) {
662+
sendChunk(operation);
662663
throw new Error('Failed to find the generated video');
663664
}
664665
sendChunk('Writing results to photo.mp4');

0 commit comments

Comments
 (0)