Skip to main content

VideoModel

Trait VideoModel 

Source
pub trait VideoModel:
    Send
    + Sync
    + 'static {
    // Required methods
    fn provider(&self) -> &ProviderId;
    fn model_id(&self) -> &ModelId;
    fn max_videos_per_call(&self) -> Option<usize>;

    // Provided methods
    fn supports_generate(&self) -> bool { ... }
    fn do_generate(
        &self,
        options: VideoOptions,
    ) -> impl Future<Output = Result<VideoResult, ProviderError>> + Send { ... }
    fn supports_operations(&self) -> bool { ... }
    fn do_start(
        &self,
        options: VideoStartOptions,
    ) -> impl Future<Output = Result<VideoStartResult, ProviderError>> + Send { ... }
    fn do_status(
        &self,
        options: VideoStatusOptions,
    ) -> impl Future<Output = Result<VideoStatusResult, ProviderError>> + Send { ... }
    fn supports_webhook(&self) -> bool { ... }
    fn handle_webhook(
        &self,
        factory: WebhookFactory,
    ) -> impl Future<Output = Result<WebhookHandle, ProviderError>> + Send { ... }
}
Expand description

A model that generates videos.

Required Methods§

Source

fn provider(&self) -> &ProviderId

Provider identifier.

Source

fn model_id(&self) -> &ModelId

Model identifier.

Source

fn max_videos_per_call(&self) -> Option<usize>

Maximum number of videos per call, or None when unknown (treated as 1).

Provided Methods§

Source

fn supports_generate(&self) -> bool

Whether do_generate is implemented.

Source

fn do_generate( &self, options: VideoOptions, ) -> impl Future<Output = Result<VideoResult, ProviderError>> + Send

Generates videos and waits for the result in one call.

Source

fn supports_operations(&self) -> bool

Whether do_start and do_status are implemented.

Source

fn do_start( &self, options: VideoStartOptions, ) -> impl Future<Output = Result<VideoStartResult, ProviderError>> + Send

Starts an asynchronous generation operation.

Source

fn do_status( &self, options: VideoStatusOptions, ) -> impl Future<Output = Result<VideoStatusResult, ProviderError>> + Send

Queries the status of an operation returned by do_start.

Source

fn supports_webhook(&self) -> bool

Whether the provider can deliver completion through a webhook.

Source

fn handle_webhook( &self, factory: WebhookFactory, ) -> impl Future<Output = Result<WebhookHandle, ProviderError>> + Send

Prepares a webhook for an operation.

The default implementation invokes factory unchanged. Providers that need to register the URL or wrap the payload override this method.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§