1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#[cfg(feature = "image")]
mod image {
use crate::image_generation::ImageGenerationModel;
/// A provider client with image generation capabilities.
/// Clone is required for conversions between client types.
pub trait ImageGenerationClient {
/// The ImageGenerationModel used by the Client
type ImageGenerationModel: ImageGenerationModel<Client = Self>;
/// Create an image generation model with the given name.
///
/// # Example with OpenAI
/// ```
/// use rig::prelude::*;
/// use rig::providers::openai::{Client, self};
///
/// // Initialize the OpenAI client
/// let openai = Client::new("your-open-ai-api-key");
///
/// let gpt4 = openai.image_generation_model(openai::DALL_E_3);
/// ```
fn image_generation_model(&self, model: impl Into<String>) -> Self::ImageGenerationModel;
/// Create an image generation model with the given name.
///
/// # Example with OpenAI
/// ```
/// use rig::prelude::*;
/// use rig::providers::openai::{Client, self};
///
/// // Initialize the OpenAI client
/// let openai = Client::new("your-open-ai-api-key");
///
/// let gpt4 = openai.image_generation_model(openai::DALL_E_3);
/// ```
fn custom_image_generation_model(
&self,
model: impl Into<String>,
) -> Self::ImageGenerationModel {
Self::ImageGenerationModel::make(self, model)
}
}
}
#[cfg(feature = "image")]
pub use image::*;