githubEdit

image-polaroidMultimodality

Orpheus supports multimodal inputs, allowing you to include images, files, and audio alongside text in your messages.

Basic Usage

Image Input

OpenRouter supports both direct URLs and base64-encoded data for images:

  • URLs: More efficient for publicly accessible images as they don’t require local encoding

  • Base64: Required for local files or private images that aren’t publicly accessible

Supported image content types are: png, jpeg, webp, gif.

image_input.rs
use orpheus::prelude::*;

fn main() -> anyhow::Result<()> {
    let client = Orpheus::from_env()?;

    let image_url = "https://misanimales.com/wp-content/uploads/2022/03/Shih-Poo-Shih-Tzu-1024x680-1-768x510.jpg";

    let message = Message::user("Describe this image").with_image(image_url);

    let response = client.chat(message).model("openai/gpt-4o").send()?;

    println!("{}", response.content()?);
    Ok(())
}

The None argument in with_image states the

File Input

Attach files with a filename and content data.

OpenRouter supports both direct URLs and base64-encoded data for files:

  • URLs: More efficient for publicly accessible files as they don’t require local encoding

  • Base64: Required for local or private files that aren’t publicly accessible

Supported image content types are: pdf.

Audio Input

Include audio content with base64-encoded data and format specification. You can search for models that support audio herearrow-up-right.

Supported image content types are: wav, mp3.

Note: Audio files must be base64-encoded - direct URLs are not supported for audio content.

Last updated

Was this helpful?