Skip to main content

ImageGenerationClient

Trait ImageGenerationClient 

Source
pub trait ImageGenerationClient {
    type ImageGenerationModel: ImageGenerationModel<Client = Self>;

    // Required method
    fn image_generation_model(
        &self,
        model: impl Into<String>,
    ) -> Self::ImageGenerationModel;

    // Provided method
    fn custom_image_generation_model(
        &self,
        model: impl Into<String>,
    ) -> Self::ImageGenerationModel { ... }
}
Expand description

A provider client with image generation capabilities. Clone is required for conversions between client types.

Required Associated Types§

Source

type ImageGenerationModel: ImageGenerationModel<Client = Self>

The ImageGenerationModel used by the Client

Required Methods§

Source

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);

Provided Methods§

Source

fn custom_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);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl ImageGenerationClient for rig::bedrock::client::Client

Source§

impl<M, Ext, H> ImageGenerationClient for rig::client::Client<Ext, H>
where Ext: Capabilities<H, ImageGeneration = Capable<M>>, M: ImageGenerationModel<Client = Client<Ext, H>>,

Available on crate feature image only.