Skip to content

Conversation

@pavelgj
Copy link
Collaborator

@pavelgj pavelgj commented Jun 3, 2025

new operation API

  let { operation } = await ai.generate({
    model: googleAI.model('veo-2.0-generate-001'),
    prompt: 'banana riding a bicycle',
  });
  if (!operation) throw new Error('expected operation');

  // or BETA api:
  let operation = await ai.generateOperation({
    model: googleAI.model('veo-2.0-generate-001'),
    prompt: 'banana riding a bicycle',
  });

  while (!operation.done) {
    operation = await ai.checkOperation(operation);
    await new Promise((resolve) => setTimeout(resolve, 5000));
  }

  return operation;

Checklist (if applicable):

@pavelgj pavelgj requested review from ifielker and mbleigh June 3, 2025 23:52
@pavelgj pavelgj marked this pull request as ready for review June 5, 2025 00:02
@github-actions github-actions bot added the python Python label Jun 5, 2025
pavelgj added 6 commits June 11, 2025 16:18
Renames the `Operation` type and schema to `ModelOperation` to avoid naming conflicts with other potential `Operation` types within the codebase. This change improves clarity and prevents potential confusion.
Corrected "fianal" to "final" in the JSDoc comment for the `generateOperation` method.
Corrected a typo in the example code for the `generateOperation` method in the `GenkitBeta` class. The method name was incorrectly spelled as `generategenerateOperation`.
Simplify the check for message content existence by using optional chaining. This makes the code more concise and readable.
This commit renames the `ImagenInstance` interface to `VeoInstance` to align with the model name and improve code clarity. It also renames the `Operation` type to `ModelOperation` for better distinction.
Previously, the `finishReason` was always set to 'pending' for VEO model operations, even when the operation was complete. This commit updates the logic to set `finishReason` to 'stop' when the VEO operation's `done` property is true, accurately reflecting the state of the operation.
@pavelgj pavelgj requested a review from ifielker June 11, 2025 20:26
@pavelgj pavelgj enabled auto-merge (squash) June 11, 2025 20:56
@pavelgj pavelgj merged commit 2f7d612 into main Jun 11, 2025
11 checks passed
@pavelgj pavelgj deleted the pj/js-googleai-imagen-veo branch June 11, 2025 21:03
hendrixmar pushed a commit that referenced this pull request Jun 12, 2025
cabljac pushed a commit to invertase/genkit that referenced this pull request Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment