Skip to main content
Generate images using DALL-E or other image models.

Quick Start

1

Generate Image

use praisonai::{Agent, tool};

#[tool]
async fn generate_image(prompt: String) -> String {
    // Uses DALL-E via tool
    let url = dalle::generate(&prompt).await?;
    url
}

let agent = Agent::new()
    .name("Artist")
    .instructions("Generate images based on descriptions")
    .tool(generate_image)
    .build()?;

agent.chat("Create a sunset over mountains").await?;

Configuration

OptionTypeDefaultDescription
modelStringdall-e-3Image model
sizeString1024x1024Image size
qualityStringstandardImage quality

Best Practices

Detailed prompts produce better images - include style, lighting, and composition.
Smaller images are faster and cheaper - use larger only when needed.