Skip to main content

bitrouter_core/models/image/
call_options.rs

1use http::HeaderMap;
2use tokio_util::sync::CancellationToken;
3
4use crate::models::{image::file::ImageModelFile, shared::provider::ProviderOptions};
5
6/// The options for calling an image generation model.
7#[derive(Debug, Clone)]
8pub struct ImageModelCallOptions {
9    /// An optional prompt to guide the image generation, if supported by the model.
10    pub prompt: Option<String>,
11    /// The number of images to generate.
12    pub n: u32,
13    /// The desired size of the generated images.
14    pub size: Option<ImageModelCallOptionsSize>,
15    /// The desired aspect ratio of the generated images, if supported by the model.
16    pub aspect_ratio: Option<ImageModelCallOptionsAspectRatio>,
17    /// An optional seed for the random number generator, if supported by the model.
18    pub seed: Option<u64>,
19    /// Optional files to use as input for the image generation, if supported by the model.
20    pub files: Option<Vec<ImageModelFile>>,
21    /// An optional file to use as a mask for inpainting, if supported by the model.
22    pub mask: Option<ImageModelFile>,
23    /// Optional provider-specific options for the image generation model.
24    pub provider_options: Option<ProviderOptions>,
25    /// An optional signal to abort the image generation request.
26    pub abort_signal: Option<CancellationToken>,
27    /// Optional HTTP headers to include in the image generation request.
28    pub headers: Option<HeaderMap>,
29}
30
31/// The size of the generated image, specified as width and height in pixels.
32#[derive(Debug, Clone)]
33pub struct ImageModelCallOptionsSize {
34    pub width: u32,
35    pub height: u32,
36}
37
38/// The aspect ratio of the generated image, specified as width and height ratios.
39#[derive(Debug, Clone)]
40pub struct ImageModelCallOptionsAspectRatio {
41    pub width: u32,
42    pub height: u32,
43}