pub trait ImageModel:
Send
+ Sync
+ Debug {
// Required methods
fn provider(&self) -> &str;
fn model_id(&self) -> &str;
fn do_generate<'life0, 'async_trait>(
&'life0 self,
options: ImageOptions,
) -> Pin<Box<dyn Future<Output = Result<ImageResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn specification_version(&self) -> &'static str { ... }
fn max_images_per_call<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<u32>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Contract every image-generation model implements.
Required Methods§
Sourcefn do_generate<'life0, 'async_trait>(
&'life0 self,
options: ImageOptions,
) -> Pin<Box<dyn Future<Output = Result<ImageResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn do_generate<'life0, 'async_trait>(
&'life0 self,
options: ImageOptions,
) -> Pin<Box<dyn Future<Output = Result<ImageResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate images.
§Errors
Returns a crate::ProviderError when the upstream call fails or
the response is malformed.
Provided Methods§
Sourcefn specification_version(&self) -> &'static str
fn specification_version(&self) -> &'static str
Specification version (currently "v4").
Mirrors ImageModelV4.specificationVersion (ai-sdk
image-model-v4.ts). Provider impls inherit the default.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".