Image Generation

Generate images with AI agents

Generate images using DALL-E or other image models.

Diagram

Image Generation

📝 Prompt

🤖 Agent

🖼️ Image

Quick Start

  1. Generate Image
    rust
    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

Be specific in prompts

Detailed prompts produce better images – include style, lighting, and composition.

Consider image size

Smaller images are faster and cheaper – use larger only when needed.


Related