Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions packages/alibaba-video/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# @hypit/alibaba-video

Alibaba Video Generation Model Support for Hypit

## Overview

This package provides integration with Alibaba's video generation models, specifically the **Qwen Video Generation (Qwen VVG)** model. It enables AI-powered video generation with text prompts and optional reference images.

## Features

- **Text-to-Video Generation**: Generate videos from text prompts
- **Reference-Based Generation**: Use reference images to guide the generation style
- **Configurable Resolution**: Support for 480p, 720p, and 1080p output
- **Multiple Aspect Ratios**: Support for 1:1, 16:9, 9:16, 4:3, 3:4 formats
- **Variable Duration**: Generate videos with 5-10 second duration

## Supported Models

### Alibaba Qwen Video Generation (alibaba-qwen-vvg)

- **Input**: Text prompt (max 200 characters)
- **Resolution**: 480p, 720p, 1080p
- **Duration**: 5-10 seconds
- **Aspect Ratios**: 1:1, 16:9, 9:16, 4:3, 3:4
- **Optional Reference**: Image for style guidance

## Usage

### Basic Text-to-Video

```markup
<alibaba:TextVideo
id="my-video"
model="qwen-vvg"
prompt={description}
duration="6"
resolution="720p"
aspect-ratio="16:9"
/>
```

### Video Generation with Reference Image

```markup
<alibaba:ReferenceVideo
id="styled-video"
model="qwen-vvg"
prompt={description}
duration="8"
resolution="1080p"
aspect-ratio="9:16"
reference-image={style.image}
/>
```

## Configuration

### Prompt
- Maximum 200 characters
- Should describe the desired video content clearly

### Duration
- Range: 5-10 seconds
- Must be a whole number

### Resolution
- `480p`: Lower quality, faster generation
- `720p`: Standard quality (default)
- `1080p`: High quality, longer generation time

### Aspect Ratio
- `16:9`: Landscape (default)
- `9:16`: Portrait/vertical
- `1:1`: Square
- `4:3`: Standard
- `3:4`: Vertical standard

## Architecture

The package follows Hypit's standard model integration pattern:

- **Generation Ports**: Defines input/output structure
- **Markup Surfaces**: Provides XML/markup interface for video generation
- **Fragment Builders**: Creates generation fragments with proper request sealing
- **Surface Decoders**: Converts markup into generation requests

## Dependencies

- `@hypit/artifact`: Artifact type definitions
- `@hypit/generation`: Generation request/port infrastructure
- `@hypit/model-kit`: Model module definition utilities
- `@hypit/markup`: Markup surface definitions
- `@hypit/elaborator`: Fragment building and activation context
- `@hypit/text`: Text type definitions
- `@hypit/protocol`: Core protocol definitions

## License

See LICENSE file in the repository root.
22 changes: 22 additions & 0 deletions packages/alibaba-video/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@hypit/alibaba-video",
"version": "0.0.0-dev",
"license": "SEE LICENSE IN LICENSE",
"private": true,
"type": "module",
"exports": {
".": "./src/index.ts"
},
"hypit": {
"activation": "./src/activation.ts"
},
"dependencies": {
"@hypit/artifact": "workspace:*",
"@hypit/elaborator": "workspace:*",
"@hypit/generation": "workspace:*",
"@hypit/model-kit": "workspace:*",
"@hypit/protocol": "workspace:*",
"@hypit/text": "workspace:*",
"@hypit/markup": "workspace:*"
}
}
24 changes: 24 additions & 0 deletions packages/alibaba-video/src/activation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Alibaba Video Generation Model Activation
* Registers the model and surfaces with the Hypit system
*/

import type { ActivationContext } from "@hypit/elaborator";
import {
alibabaVideoComponent,
alibabaVideoManifest,
alibabaVideoMarkupSurfaces,
} from "./index.js";

export function activate(context: ActivationContext) {
// Register the model component
context.component(alibabaVideoComponent);

// Register the manifest
context.manifest(alibabaVideoManifest);

// Register all markup surfaces
for (const surface of alibabaVideoMarkupSurfaces) {
context.surface(surface);
}
}
38 changes: 38 additions & 0 deletions packages/alibaba-video/src/fragment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Alibaba Video Generation Fragment Builders
* Provides functions to create generation fragments for video generation requests
*/

import type { AssembledGenerationFragment, GenerationFragment } from "@hypit/elaborator";
import {
createAssembledGenerationFragment,
createGenerationFragment,
} from "@hypit/elaborator";
import {
alibabaVideoEndpoints,
sealAlibabaVideoRequest,
type AlibabaVideoPortMap,
} from "./index.js";

/**
* Creates an assembled generation fragment for Alibaba video generation
* with resolved media bindings and draft type information
*/
export function createAlibabaVideoAssembledGenerationFragment(
ports: AlibabaVideoPortMap
): AssembledGenerationFragment {
const endpoint = alibabaVideoEndpoints.qwenVvg!;
const request = sealAlibabaVideoRequest("alibaba-qwen-vvg", ports);
return createAssembledGenerationFragment(endpoint, request);
}

/**
* Creates a generation fragment for Alibaba video generation
*/
export function createAlibabaVideoGenerationFragment(
ports: AlibabaVideoPortMap
): GenerationFragment {
const endpoint = alibabaVideoEndpoints.qwenVvg!;
const request = sealAlibabaVideoRequest("alibaba-qwen-vvg", ports);
return createGenerationFragment(endpoint, request);
}
Loading