feat(ai-gemini): add Google Veo video adapter on the typed-duration contract#741
Conversation
…ontract (#634) Builds the Veo adapter directly on the per-model typed-duration VideoAdapter contract from #534: - Uncomment + finalize the five Veo model entries in model-meta.ts and add a GEMINI_VIDEO_MODELS union. - Add video/video-provider-options.ts with GeminiVideoModelDurationByName, GeminiVideoModelSizeByName, and a docs-curated GEMINI_VIDEO_DURATIONS map (the ai-schemas Gemini spec types :predictLongRunning parameters as unknown, so it carries no per-model duration data). - Implement GeminiVideoAdapter over @google/genai generateVideos / getVideosOperation with availableDurations/snapDuration overrides, RAI filter surfacing, and geminiVideo/createGeminiVideo factories. - Wire gemini into the video-gen E2E feature matrix with a Veo predictLongRunning + operations mount in global-setup. - Update video-generation docs and the media-generation skill. - Fix pre-existing no-unnecessary-type-assertion lint errors in the base branch's snap.ts / fal video.ts so the stacked PR gate is green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Changeset Version Preview4 package(s) bumped directly, 27 bumped as dependents. 🟥 Major bumps
🟨 Minor bumps
🟩 Patch bumps
|
|
View your CI Pipeline Execution ↗ for commit 27eaac5
☁️ Nx Cloud last updated this comment at |
@tanstack/ai
@tanstack/ai-anthropic
@tanstack/ai-client
@tanstack/ai-code-mode
@tanstack/ai-code-mode-skills
@tanstack/ai-devtools-core
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-groq
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-ollama
@tanstack/ai-openai
@tanstack/ai-openrouter
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-react-ui
@tanstack/ai-schemas
@tanstack/ai-solid
@tanstack/ai-solid-ui
@tanstack/ai-svelte
@tanstack/ai-utils
@tanstack/ai-vue
@tanstack/ai-vue-ui
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
commit: |
🎯 Changes
Closes #634. Stacked on #641 (
534-video-duration-support), which is itself stacked on #622 — this PR targets the #641 branch and should merge after it (or land through the stack).Adds a Google Veo video adapter to
@tanstack/ai-gemini, built directly on the per-model typed-durationVideoAdaptercontract from #534:model-meta.ts— uncomments and finalizes the five Veo entries (veo-3.1-generate-preview,veo-3.1-fast-generate-preview,veo-3.0-generate-001,veo-3.0-fast-generate-001,veo-2.0-generate-001) and adds aGEMINI_VIDEO_MODELSunion. The staleGeminiGenerationConfigOptionsreference in the commented code was replaced with the same options intersection the Imagen entries use.video/video-provider-options.ts—GeminiVideoModelDurationByName,GeminiVideoModelSizeByName(Veo sizes are aspect ratios'16:9' | '9:16';resolutionlives inmodelOptions), and aGEMINI_VIDEO_DURATIONSruntime table.GeminiVideoProviderOptionsis the vendorGenerateVideosConfigminus the fields the adapter manages (durationSeconds,aspectRatio, transport).adapters/video.ts—GeminiVideoAdapterextendsBaseVideoAdapterwith the fifth generic, drivingmodels.generateVideos(:predictLongRunning) /operations.getVideosOperation.getVideoStatusmapsdone/errorand surfaces all-samples-RAI-filtered asfailedwith the reasons;getVideoUrlreturnsresponse.generatedVideos[0].video.uri.availableDurations/snapDurationoverridden viasnapToDurationOption.geminiVideo/createGeminiVideoexported from the package root, following the image adapter pattern.'gemini'added to thevideo-genfeature set;global-setup.tsmounts Veo's:predictLongRunning+ operations-poll endpoints (aimock 1.29 mocks Gemini:predictbut not the long-running pair), responding with the raw MLDev wire shape the SDK normalizes. All three transports (SSE, HTTP stream, fetcher) pass the full job lifecycle.docs/media/video-generation.md(typed durations table,snapDurationexample, download-auth note) and themedia-generationSKILL.md.Deviations from the issue
4 | 8and Veo 2 =5–8. The issue asked to confirm before locking; the@tanstack/ai-schemasGemini spec types:predictLongRunningparametersasz.unknown()(no duration data), and the current official Veo docs say Veo 3.x:4 | 6 | 8, Veo 2:5 | 6 | 8— those are what shipped. ConsequentlysnapDuration(7)returns6(closest), not8as the issue's acceptance line assumed. I attempted live API confirmation via invalid-duration probes, but the key's prepaid credits are depleted (429 before validation), so docs are the source of truth.durationSeconds?: numberin the SDK), not strings as for Sora.pnpm test:pron the base branch fails@typescript-eslint/no-unnecessary-type-assertioninsnap.tsandai-fal/adapters/video.ts(the red Test check on feat(ai,ai-fal): per-model typed durations for video generation #641). This PR includes theeslint --fixone-liners so the stacked gate is green — feel free to cherry-pick them into feat(ai,ai-fal): per-model typed durations for video generation #641 instead.Acceptance criteria
geminiVideo('veo-3.0-generate-001')hasduration?: 4 | 6 | 8at compile time (asserted withexpectTypeOfintests/video-adapter.test.ts)adapter.availableDurations()→{ kind: 'discrete', values: [4, 6, 8] }adapter.snapDuration(7)→6(see deviation note above)✅ Checklist
pnpm run test:pr.🚀 Release Impact
🤖 Generated with Claude Code