rig_core/client/image_generation.rs
1#[cfg(feature = "image")]
2mod image {
3 use crate::image_generation::ImageGenerationModel;
4
5 /// A provider client with image generation capabilities.
6 /// Clone is required for conversions between client types.
7 pub trait ImageGenerationClient {
8 /// The ImageGenerationModel used by the Client
9 type ImageGenerationModel: ImageGenerationModel<Client = Self>;
10
11 /// Create an image generation model with the given name.
12 ///
13 /// # Example with OpenAI
14 /// ```no_run
15 /// use rig_core::prelude::*;
16 /// use rig_core::providers::openai::{Client, self};
17 ///
18 /// # fn run() -> Result<(), Box<dyn std::error::Error>> {
19 /// // Initialize the OpenAI client
20 /// let openai = Client::new("your-open-ai-api-key")?;
21 ///
22 /// let gpt4 = openai.image_generation_model(openai::DALL_E_3);
23 /// # Ok(())
24 /// # }
25 /// ```
26 fn image_generation_model(&self, model: impl Into<String>) -> Self::ImageGenerationModel;
27 }
28}
29
30#[cfg(feature = "image")]
31pub use image::*;