Skip to main content

VideoModelMiddleware

Trait VideoModelMiddleware 

Source
pub trait VideoModelMiddleware:
    Send
    + Sync
    + Debug {
    // Provided methods
    fn override_provider(&self, _inner: &dyn VideoModel) -> Option<String> { ... }
    fn override_model_id(&self, _inner: &dyn VideoModel) -> Option<String> { ... }
    fn override_max_videos_per_call<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _inner: &'life1 dyn VideoModel,
    ) -> Pin<Box<dyn Future<Output = Option<Option<u32>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn transform_params<'life0, 'life1, 'async_trait>(
        &'life0 self,
        params: VideoOptions,
        _inner: &'life1 dyn VideoModel,
    ) -> Pin<Box<dyn Future<Output = Result<VideoOptions>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn wrap_generate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        next: &'life1 dyn VideoModel,
        params: VideoOptions,
    ) -> Pin<Box<dyn Future<Output = Result<VideoResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Contract for middleware that decorates a VideoModel.

Provided Methods§

Source

fn override_provider(&self, _inner: &dyn VideoModel) -> Option<String>

Override the provider id exposed by the wrapped model.

Source

fn override_model_id(&self, _inner: &dyn VideoModel) -> Option<String>

Override the model id exposed by the wrapped model.

Source

fn override_max_videos_per_call<'life0, 'life1, 'async_trait>( &'life0 self, _inner: &'life1 dyn VideoModel, ) -> Pin<Box<dyn Future<Output = Option<Option<u32>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn transform_params<'life0, 'life1, 'async_trait>( &'life0 self, params: VideoOptions, _inner: &'life1 dyn VideoModel, ) -> Pin<Box<dyn Future<Output = Result<VideoOptions>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Transform the video options before they reach the inner model.

§Errors

Return a crate::ProviderError to fail the call without invoking the model.

Source

fn wrap_generate<'life0, 'life1, 'async_trait>( &'life0 self, next: &'life1 dyn VideoModel, params: VideoOptions, ) -> Pin<Box<dyn Future<Output = Result<VideoResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Wrap a video-generation call.

Default: forwards to next.do_generate(params).

§Errors

Returns whatever error next returns, or a middleware-introduced failure.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§