Trait ImageProvider

Source
pub trait ImageProvider: Send + Sync {
    type Config: ProviderConfig;
    type Response: ImageResponse;
    type Error: ProviderError;

    // Required method
    fn generate_image<'life0, 'async_trait>(
        &'life0 self,
        request: ImageRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Expand description

Optional trait for providers that support image generation.

Required Associated Types§

Source

type Config: ProviderConfig

Provider-specific configuration type

Source

type Response: ImageResponse

Provider-specific response type

Source

type Error: ProviderError

Provider-specific error type

Required Methods§

Source

fn generate_image<'life0, 'async_trait>( &'life0 self, request: ImageRequest, ) -> Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Generate images from a text prompt.

§Arguments
  • request - The image generation request
§Returns

A result containing the generated images or an error

Implementors§