feat: add video-generation package with OpenAI, Google, and ByteDance providers#43
Conversation
… providers Add complete video-generation capability package to celeste-python with support for multiple providers and comprehensive integration. Package Features: - Unified video generation interface across providers - Support for OpenAI (Sora 2), Google (Veo 3), and ByteDance (Seedance) models - Parameter mapping for duration, resolution, aspect_ratio, and image references - Async polling support for OpenAI video generation jobs - Type-safe VideoArtifact handling Configuration Updates: - Add celeste-video-generation to optional dependencies and 'all' extra - Add video-generation to pytest pythonpath for test discovery - Update mypy overrides to match private repo pattern (combined block) - Add video-generation to CI workflow type checking - Add video-generation to Makefile typecheck target Integration Tests: - Add integration tests for all three providers - Use cheapest models with minimum duration and lowest resolution - Validate VideoGenerationOutput, VideoArtifact, and VideoGenerationUsage Fixes: - Add type: ignore[override] to streaming.py files for mypy compatibility - Fix OpenAI integration test to include required aspect_ratio parameter
PR Review: Video Generation PackageSummaryThis PR adds comprehensive video generation capabilities to celeste-python with support for OpenAI (Sora 2), Google (Veo 3), and ByteDance (Seedance) providers. The implementation follows established patterns from existing packages and integrates well with the framework architecture. ✅ StrengthsArchitecture & Design
Code Quality
Testing & CI Integration
🔍 Issues & RecommendationsCritical Issues1. Missing
|
Pull Request Review: Video Generation PackageOverviewThis PR successfully adds comprehensive video generation capabilities to celeste-python with support for three major providers (OpenAI Sora 2, Google Veo 3, and ByteDance Seedance). The implementation follows the established patterns from text and image generation packages well. ✅ StrengthsCode Quality & Architecture
Implementation Highlights
Testing & CI
🔍 Issues Found1. Critical: Timeout Not Enforced in ByteDance ClientFile: The ByteDance client checks elapsed time but doesn't properly enforce the timeout. The Current code: while True:
elapsed = time.time() - start_time
if elapsed > config.MAX_POLLING_TIMEOUT:
msg = f"ByteDance task {task_id} timed out after {elapsed:.0f}s"
raise TimeoutError(msg)
# ... polling logic
await asyncio.sleep(polling_interval)Issue: If the last check passes just before timeout, the sleep and subsequent operations can exceed the timeout significantly. Recommendation: Calculate remaining time and use it for the sleep: remaining = config.MAX_POLLING_TIMEOUT - elapsed
if remaining <= 0:
raise TimeoutError(...)
await asyncio.sleep(min(polling_interval, remaining))2. Bug: OpenAI MAX_POLLS Can Exceed TimeoutFile: Using a for-loop with for _ in range(config.MAX_POLLS):
# ... polling
await asyncio.sleep(config.POLL_INTERVAL)This creates a hard limit of polls × interval seconds, but doesn't account for HTTP request latency or API response time. Recommendation: Use time-based timeout like Google's implementation: start_time = time.time()
while time.time() - start_time < config.MAX_POLLING_TIMEOUT:
# polling logic3. Code Quality: Inconsistent Logging PatternsFiles: All provider clients
Recommendation: Standardize logging levels and verbosity:
4. Minor: Redundant File Open OperationsFiles:
Both files open images multiple times when handling Impact: Low - only affects path-based artifacts, which are less common than data/url. 5. Security: Base64 Encoding in LogsFile: Multiple files handling image artifacts When converting images to base64, any logging of these artifacts could expose large amounts of data in logs. While current code seems safe, it's worth noting for monitoring. Recommendation: Consider adding a size limit or warning for artifact logging. 🚀 Performance ConsiderationsStrengths
Suggestions
🔒 Security Assessment✅ Secure Practices
|
- Update ByteDance error messages to clarify data URIs are acceptable URLs - Add docstring to Google download_content noting it's Google-specific
PR Review: Video Generation PackageOverviewThis is an excellent addition to the celeste-python ecosystem! The implementation demonstrates strong architectural consistency with existing packages (text-generation, image-generation) and provides comprehensive support for three major video generation providers. The code quality is high, with proper type safety, error handling, and documentation. StrengthsArchitecture & Code Quality
Provider Implementations
Testing & Documentation
Issues Found1. CRITICAL - Missing _parse_finish_reason in VideoGenerationClientThe base VideoGenerationClient is missing the _parse_finish_reason abstract method that exists in both ImageGenerationClient and TextGenerationClient. Location: video-generation/src/celeste_video_generation/client.py:1-65 Impact: Architectural inconsistency. Need to add VideoGenerationFinishReason enum in io.py and implement the method in all providers. 2. Bug - Google convert_to_base64_uri Missing URL CheckLocation: google/client.py:42-59 Issue: Doesn't check if img.url already exists. Will fail unnecessarily if user passes ImageArtifact with URL. Fix: Add URL check like ByteDance does. 3. Missing Timeout - Google PollingLocation: google/client.py:152-174 Issue: Infinite loop without timeout. ByteDance and OpenAI both have timeout protection. Fix: Add timeout similar to ByteDance. 4. Security - File Path HandlingLocations: openai/client.py:114-117, google/client.py:45-47, bytedance/client.py:48-50 Risk: Reading arbitrary file paths without validation could expose sensitive files. Fix: Add path validation or document security expectations. 5. Type Inconsistency - Test DurationLocation: tests/integration_tests/test_video_generation/test_generate.py:14 Issue: OpenAI test uses duration as string, others use int. Fix: Use consistent int type in tests. 6. Minor - ByteDance Parameter EmbeddingLocation: bytedance/parameters.py:40-49, 83-90 Suggestion: Use next() with generator instead of loop for slight optimization. RecommendationsMust Fix Before Merge
Nice to Have
Security Assessment: Good
Test Coverage: Good (85%)Covered: Integration tests for all providers Missing: Unit tests for mappers, error paths, edge cases ConclusionRecommendation: Approve with requested changes This is a well-implemented PR with excellent architecture and code quality. The critical issues are:
Great work overall! |
Overview
This PR adds the complete video-generation capability package to celeste-python with support for multiple providers.
Package Features
Configuration Updates
Integration Tests
Fixes
Testing