{
  "name": "forge-media",
  "language": "rust",
  "version": "0.2.0",
  "description": "Image, transcription, speech, and video generation for the Forge SDK",
  "manifest": "forge-rs/crates/forge-media/Cargo.toml",
  "manifestSha256": "16eed4bbe2211ab647b2b84c13f59d1d0ec3de943641b44621eb4cd2bc332129",
  "status": "source-reference",
  "registryPublicationVerified": false,
  "route": "/libraries/rust/forge-media",
  "features": {},
  "files": [
    {
      "path": "forge-rs/crates/forge-media/src/error.rs",
      "sha256": "de7c9ef18ea09a0f66361d3069222cbadc993270d0634122f6eba34409c805e8",
      "artifactSha256": "a2b822e660805ac511299a04cabe5dce2f8d878c4d5be503f428de54da3d4bf6",
      "url": "/reference/source/forge-rs/crates/forge-media/src/error.rs.txt",
      "declarations": [
        {
          "name": "::ForgeMediaError",
          "line": 34,
          "signature": "#[derive(Debug, Error)]\npub enum ForgeMediaError {\n    /// Image generation failed.\n    ///\n    /// Returned when the underlying `ImageProvider::generate_image()` call\n    /// fails, including provider-side content filters, rate limits, and\n    /// invalid prompt errors.\n    #[error(\"image generation failed for model '{model}': {reason}\")]\n    GenerationFailed {\n        /// The model identifier (e.g., \"dall-e-3\").\n        model: String,\n        /// The error message from the provider.\n        reason: String,\n    },\n\n    /// Audio transcription failed.\n    ///\n    /// Returned when the underlying `TranscriptionProvider::transcribe()` call\n    /// fails, including invalid audio data, unsupported codecs, and provider\n    /// errors.\n    #[error(\"transcription failed for model '{model}': {reason}\")]\n    TranscriptionFailed {\n        /// The model identifier (e.g., \"whisper-1\").\n        model: String,\n        /// The error message from the provider.\n        reason: String,\n    },\n\n    /// Speech synthesis failed.\n    ///\n    /// Returned when the underlying `SpeechProvider::speak()` call fails,\n    /// including invalid voice identifiers, excessively long input, and\n    /// provider errors.\n    #[error(\"speech synthesis failed for model '{model}': {reason}\")]\n    SpeechFailed {\n        /// The model identifier (e.g., \"tts-1\").\n        model: String,\n        /// The error message from the provider.\n        reason: String,\n    },\n\n    /// Video generation failed.\n    ///\n    /// Returned when the underlying `VideoProvider::generate_video()` call\n    /// fails, including content filters, invalid dimensions, and provider\n    /// errors.\n    #[error(\"video generation failed for model '{model}': {reason}\")]\n    VideoFailed {\n        /// The model identifier (e.g., \"sora-1\").\n        model: String,\n        /// The error message from the provider.\n        reason: String,\n    },\n\n    /// The requested media format is not supported.\n    ///\n    /// Returned when a format is requested that the provider does not support,\n    /// or when input data uses an unrecognized encoding.\n    #[error(\"unsupported format '{format}': {reason}\")]\n    UnsupportedFormat {\n        /// The format that was requested (e.g., \"tiff\", \"aac\").\n        format: String,\n        /// Why the format is not supported.\n        reason: String,\n    },\n\n    /// A `forge-core` error occurred during a media operation.\n    #[error(\"core error: {0}\")]\n    Core(#[from] forge_core::error::ForgeError),\n}",
          "documentation": "Error type for media operations.\n\nCovers image generation failures, transcription errors, speech synthesis\nfailures, video generation errors, unsupported format requests, and\npropagated core errors.\n\n# Examples\n\n```\nuse forge_media::ForgeMediaError;\n\nlet err = ForgeMediaError::GenerationFailed {\n    model: \"dall-e-3\".to_string(),\n    reason: \"content policy violation\".to_string(),\n};\nlet msg = err.to_string();\nassert!(msg.contains(\"dall-e-3\"));\nassert!(msg.contains(\"content policy violation\"));\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-media/src/image.rs",
      "sha256": "792e2d275812ea8f56797ef026fdb45fc3c1ec57c3424d9070ccba72070f78e5",
      "artifactSha256": "d1fdcdb577cb464dd59a888440494670f081746d9febfd3970d2541240dbe0f1",
      "url": "/reference/source/forge-rs/crates/forge-media/src/image.rs.txt",
      "declarations": [
        {
          "name": "::ImageFormat",
          "line": 48,
          "signature": "#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]\n#[serde(rename_all = \"lowercase\")]\npub enum ImageFormat {\n    /// PNG (Portable Network Graphics) \u2014 lossless compression.\n    #[default]\n    Png,\n    /// JPEG \u2014 lossy compression, smaller file sizes.\n    Jpeg,\n    /// WebP \u2014 modern format with both lossy and lossless modes.\n    Webp,\n}",
          "documentation": "The output format for generated images.\n\nDetermines the encoding used for the image bytes in [`ImageResult::data`].\n\n# Examples\n\n```\nuse forge_media::image::ImageFormat;\n\nlet format = ImageFormat::Png;\nassert_eq!(format.mime_type(), \"image/png\");\nassert_eq!(format.extension(), \"png\");\n```"
        },
        {
          "name": "::ImageFormat::mime_type",
          "line": 74,
          "signature": "pub fn mime_type(&self) -> &'static str;",
          "documentation": "Returns the MIME type string for this format.\n\n# Returns\n\nA static MIME type string suitable for HTTP `Content-Type` headers.\n\n# Examples\n\n```\nuse forge_media::image::ImageFormat;\n\nassert_eq!(ImageFormat::Png.mime_type(), \"image/png\");\nassert_eq!(ImageFormat::Jpeg.mime_type(), \"image/jpeg\");\nassert_eq!(ImageFormat::Webp.mime_type(), \"image/webp\");\n```"
        },
        {
          "name": "::ImageFormat::extension",
          "line": 93,
          "signature": "pub fn extension(&self) -> &'static str;",
          "documentation": "Returns the file extension for this format (without the dot).\n\n# Examples\n\n```\nuse forge_media::image::ImageFormat;\n\nassert_eq!(ImageFormat::Png.extension(), \"png\");\nassert_eq!(ImageFormat::Jpeg.extension(), \"jpeg\");\nassert_eq!(ImageFormat::Webp.extension(), \"webp\");\n```"
        },
        {
          "name": "::ImageOptions",
          "line": 129,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct ImageOptions {\n/// Desired width in pixels.\n\npub width: u32,\n/// Desired height in pixels.\n\npub height: u32,\n/// Output image format.\n\npub format: ImageFormat,\n/// Output quality (0-100). Applicable to lossy formats like JPEG and WebP.\n\n/// `None` means the provider's default quality.\n\npub quality: Option<u8>,\n/// Style hint for the generation model (e.g., \"photorealistic\", \"watercolor\").\n\n/// `None` means the provider's default style.\n\npub style: Option<String>\n}",
          "documentation": "Configuration options for image generation.\n\nControls the output dimensions, format, quality, and style of generated images.\nAll fields except `format` are optional; providers will use their own defaults\nfor unspecified values.\n\n# Examples\n\n```\nuse forge_media::image::{ImageFormat, ImageOptions};\n\nlet options = ImageOptions {\n    width: 1024,\n    height: 1024,\n    format: ImageFormat::Png,\n    quality: Some(90),\n    style: Some(\"photorealistic\".to_string()),\n};\nassert_eq!(options.width, 1024);\n```"
        },
        {
          "name": "::ImageResult",
          "line": 176,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct ImageResult {\n/// The raw image bytes in the format specified by `mime_type`.\n\npub data: Vec<u8>,\n/// The MIME type of the image data (e.g., \"image/png\").\n\npub mime_type: String,\n/// The width of the generated image in pixels.\n\npub width: u32,\n/// The height of the generated image in pixels.\n\npub height: u32,\n/// The model that generated this image (e.g., \"dall-e-3\").\n\npub model: String\n}",
          "documentation": "The result of an image generation operation.\n\nContains the raw image bytes along with metadata about the generated image.\n\n# Examples\n\n```\nuse forge_media::image::ImageResult;\n\nlet result = ImageResult {\n    data: vec![0x89, 0x50, 0x4E, 0x47],\n    mime_type: \"image/png\".to_string(),\n    width: 1024,\n    height: 1024,\n    model: \"dall-e-3\".to_string(),\n};\nassert_eq!(result.data.len(), 4);\nassert_eq!(result.mime_type, \"image/png\");\n```"
        },
        {
          "name": "::ImageProvider",
          "line": 232,
          "signature": "#[async_trait]\npub trait ImageProvider: Send + Sync {\n    /// Returns the model identifier (e.g., \"dall-e-3\", \"stable-diffusion-xl\").\n    fn model_id(&self) -> &str;\n\n    /// Returns the provider name (e.g., \"openai\", \"stability\").\n    fn provider_name(&self) -> &str;\n\n    /// Generates an image from a text prompt.\n    ///\n    /// # Arguments\n    ///\n    /// * `prompt` - The text description of the image to generate.\n    /// * `options` - Configuration for output dimensions, format, quality, and style.\n    ///\n    /// # Returns\n    ///\n    /// An [`ImageResult`] containing the generated image bytes and metadata.\n    ///\n    /// # Errors\n    ///\n    /// * [`ForgeMediaError::GenerationFailed`] -- if the provider returns an error.\n    /// * [`ForgeMediaError::UnsupportedFormat`] -- if the requested format is not supported.\n    async fn generate_image(\n        &self,\n        prompt: &str,\n        options: &ImageOptions,\n    ) -> Result<ImageResult, ForgeMediaError>;\n}",
          "documentation": "A provider capable of generating images from text prompts.\n\nImplementations of this trait connect to specific image generation backends\n(e.g., DALL-E, Stable Diffusion, Midjourney). The provider is responsible\nfor translating the generic [`ImageOptions`] into provider-specific API calls\nand returning the result as an [`ImageResult`].\n\n# ANVIL Spec S6.3\n\nThe media interface is provider-agnostic. Agent code never imports a specific\nimage provider -- it uses this trait through the Forge media API.\n\n# Examples\n\n```no_run\nuse async_trait::async_trait;\nuse forge_media::image::{ImageOptions, ImageProvider, ImageResult};\nuse forge_media::ForgeMediaError;\n\nstruct MyImageProvider;\n\n#[async_trait]\nimpl ImageProvider for MyImageProvider {\n    fn model_id(&self) -> &str { \"my-model-v1\" }\n    fn provider_name(&self) -> &str { \"my-provider\" }\n\n    async fn generate_image(\n        &self,\n        prompt: &str,\n        options: &ImageOptions,\n    ) -> Result<ImageResult, ForgeMediaError> {\n        // Implementation would call the actual provider API here\n        Ok(ImageResult {\n            data: vec![0x89, 0x50, 0x4E, 0x47],\n            mime_type: options.format.mime_type().to_string(),\n            width: options.width,\n            height: options.height,\n            model: self.model_id().to_string(),\n        })\n    }\n}\n```"
        },
        {
          "name": "::generate_image",
          "line": 301,
          "signature": "pub async fn generate_image(\n    provider: &dyn ImageProvider,\n    prompt: &str,\n    options: &ImageOptions,\n) -> Result<ImageResult, ForgeMediaError>;",
          "documentation": "Generates an image from a text prompt using the specified provider.\n\nThis is the primary entry point for image generation in the Forge SDK.\nIt delegates to the provider's `generate_image` method and emits telemetry\nspans for observability.\n\n# ANVIL Spec S6.3\n\nImplements the `media.image.generate` operation defined by the ANVIL\nmedia interface.\n\n# Arguments\n\n* `provider` - The image generation provider to use.\n* `prompt` - The text description of the image to generate.\n* `options` - Configuration for output dimensions, format, quality, and style.\n\n# Returns\n\nAn [`ImageResult`] containing the generated image bytes and metadata.\n\n# Errors\n\n* [`ForgeMediaError::GenerationFailed`] -- if the provider call fails.\n* [`ForgeMediaError::UnsupportedFormat`] -- if the requested format is not supported.\n\n# Examples\n\n```no_run\nuse forge_media::image::{generate_image, ImageOptions, ImageProvider};\n\nasync fn example(provider: &dyn ImageProvider) {\n    let options = ImageOptions::default();\n    let result = generate_image(provider, \"a sunset over the ocean\", &options).await;\n    match result {\n        Ok(img) => println!(\"Generated {}x{} image\", img.width, img.height),\n        Err(e) => eprintln!(\"Failed: {e}\"),\n    }\n}\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-media/src/lib.rs",
      "sha256": "847c6e669bd3f429d1e8b317a77157accaa56e98e11e634230b44cceb94e5f7c",
      "artifactSha256": "e63946fb6f284029e5741447459cdeeebed17a34cfe9fcc1a24266d6da923621",
      "url": "/reference/source/forge-rs/crates/forge-media/src/lib.rs.txt",
      "declarations": [
        {
          "name": "error",
          "line": 90,
          "signature": "pub mod error;",
          "documentation": "# forge-media\n\nImage generation, audio transcription, speech synthesis, and video generation\nfor the Forge SDK.\n\nThis crate provides the media capabilities that agent code uses to interact with\nimage, audio, and video providers. It builds on `forge-core` error types and\nfollows the provider-agnostic pattern established across the Forge SDK:\n\n- **Image generation** -- [`image::generate_image()`] for creating images from text prompts.\n- **Transcription** -- [`transcription::transcribe()`] for converting audio to text.\n- **Speech synthesis** -- [`speech::speak()`] for converting text to spoken audio.\n- **Video generation** -- [`video::generate_video()`] for creating videos from text prompts.\n\nEach media type has a corresponding provider trait (`ImageProvider`, `TranscriptionProvider`,\n`SpeechProvider`, `VideoProvider`) that defines the interface for concrete backends.\nAgent code interacts with these traits through the top-level functions, never importing\na specific provider implementation directly.\n\n# ANVIL Spec Reference\n\nThis crate implements ANVIL Spec S6.3 -- Media Interface, which defines the optional\nmedia capabilities that ANVIL-compliant runtimes may expose. All four media types\n(image, transcription, speech, video) are implemented through pluggable provider traits.\n\n# Examples\n\n## Image Generation\n\n```no_run\nuse forge_media::image::{generate_image, ImageOptions, ImageProvider};\n\nasync fn example(provider: &dyn ImageProvider) {\n    let options = ImageOptions::default();\n    let result = generate_image(provider, \"a sunset over mountains\", &options).await;\n    match result {\n        Ok(img) => println!(\"Generated {}x{} image\", img.width, img.height),\n        Err(e) => eprintln!(\"Failed: {e}\"),\n    }\n}\n```\n\n## Audio Transcription\n\n```no_run\nuse forge_media::transcription::{transcribe, TranscriptionOptions, TranscriptionProvider};\n\nasync fn example(provider: &dyn TranscriptionProvider) {\n    let audio: Vec<u8> = vec![]; // audio bytes\n    let options = TranscriptionOptions::default();\n    let result = transcribe(provider, &audio, &options).await;\n    match result {\n        Ok(t) => println!(\"Text: {}\", t.text),\n        Err(e) => eprintln!(\"Failed: {e}\"),\n    }\n}\n```\n\n## Speech Synthesis\n\n```no_run\nuse forge_media::speech::{speak, SpeechOptions, SpeechProvider};\n\nasync fn example(provider: &dyn SpeechProvider) {\n    let options = SpeechOptions::default();\n    let result = speak(provider, \"Hello, world!\", &options).await;\n    match result {\n        Ok(s) => println!(\"Audio: {} bytes\", s.audio.len()),\n        Err(e) => eprintln!(\"Failed: {e}\"),\n    }\n}\n```\n\n## Video Generation\n\n```no_run\nuse forge_media::video::{generate_video, VideoOptions, VideoProvider};\n\nasync fn example(provider: &dyn VideoProvider) {\n    let options = VideoOptions::default();\n    let result = generate_video(provider, \"a cat playing with yarn\", &options).await;\n    match result {\n        Ok(v) => println!(\"Video: {}x{}, {:.1}s\", v.width, v.height, v.duration_seconds),\n        Err(e) => eprintln!(\"Failed: {e}\"),\n    }\n}\n```"
        },
        {
          "name": "image",
          "line": 91,
          "signature": "pub mod image;",
          "documentation": ""
        },
        {
          "name": "speech",
          "line": 92,
          "signature": "pub mod speech;",
          "documentation": ""
        },
        {
          "name": "transcription",
          "line": 93,
          "signature": "pub mod transcription;",
          "documentation": ""
        },
        {
          "name": "video",
          "line": 94,
          "signature": "pub mod video;",
          "documentation": ""
        },
        {
          "name": "pub use error::ForgeMediaError;",
          "line": 96,
          "signature": "pub use error::ForgeMediaError;",
          "documentation": ""
        },
        {
          "name": "prelude",
          "line": 99,
          "signature": "pub mod prelude;",
          "documentation": "Re-exports of the most commonly used types from the media crate."
        },
        {
          "name": "pub use crate::error::ForgeMediaError;",
          "line": 100,
          "signature": "pub use crate::error::ForgeMediaError;",
          "documentation": ""
        },
        {
          "name": "pub use crate::image::{generate_image, ImageFormat, ImageOptions, ImageProvider, ImageResult};",
          "line": 101,
          "signature": "pub use crate::image::{generate_image, ImageFormat, ImageOptions, ImageProvider, ImageResult};",
          "documentation": ""
        },
        {
          "name": "pub use crate::speech::{speak, AudioFormat, SpeechOptions, SpeechProvider, SpeechResult};",
          "line": 102,
          "signature": "pub use crate::speech::{speak, AudioFormat, SpeechOptions, SpeechProvider, SpeechResult};",
          "documentation": ""
        },
        {
          "name": "pub use crate::transcription::{\n        transcribe, TranscriptionOptions, TranscriptionProvider, TranscriptionResult,\n        TranscriptionSegment,\n    };",
          "line": 103,
          "signature": "pub use crate::transcription::{\n        transcribe, TranscriptionOptions, TranscriptionProvider, TranscriptionResult,\n        TranscriptionSegment,\n    };",
          "documentation": ""
        },
        {
          "name": "pub use crate::video::{generate_video, VideoFormat, VideoOptions, VideoProvider, VideoResult};",
          "line": 107,
          "signature": "pub use crate::video::{generate_video, VideoFormat, VideoOptions, VideoProvider, VideoResult};",
          "documentation": ""
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-media/src/speech.rs",
      "sha256": "70552b7d5e97993f9f1ecf278efe005f90936e1402dd4c207c3c5946caeae6f7",
      "artifactSha256": "5cd4c16812ea7dd1ec19c3e82769deb8fdeea0a2d25e70ed2a3606a85e0105d7",
      "url": "/reference/source/forge-rs/crates/forge-media/src/speech.rs.txt",
      "declarations": [
        {
          "name": "::AudioFormat",
          "line": 48,
          "signature": "#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]\n#[serde(rename_all = \"lowercase\")]\npub enum AudioFormat {\n    /// MP3 \u2014 widely supported lossy audio format.\n    #[default]\n    Mp3,\n    /// WAV \u2014 uncompressed PCM audio.\n    Wav,\n    /// OGG \u2014 open container format, typically with Vorbis or Opus codec.\n    Ogg,\n    /// FLAC \u2014 lossless audio compression.\n    Flac,\n}",
          "documentation": "The output format for synthesized audio.\n\nDetermines the encoding used for the audio bytes in [`SpeechResult::audio`].\n\n# Examples\n\n```\nuse forge_media::speech::AudioFormat;\n\nlet format = AudioFormat::Mp3;\nassert_eq!(format.mime_type(), \"audio/mpeg\");\nassert_eq!(format.extension(), \"mp3\");\n```"
        },
        {
          "name": "::AudioFormat::mime_type",
          "line": 77,
          "signature": "pub fn mime_type(&self) -> &'static str;",
          "documentation": "Returns the MIME type string for this format.\n\n# Returns\n\nA static MIME type string suitable for HTTP `Content-Type` headers.\n\n# Examples\n\n```\nuse forge_media::speech::AudioFormat;\n\nassert_eq!(AudioFormat::Mp3.mime_type(), \"audio/mpeg\");\nassert_eq!(AudioFormat::Wav.mime_type(), \"audio/wav\");\nassert_eq!(AudioFormat::Ogg.mime_type(), \"audio/ogg\");\nassert_eq!(AudioFormat::Flac.mime_type(), \"audio/flac\");\n```"
        },
        {
          "name": "::AudioFormat::extension",
          "line": 98,
          "signature": "pub fn extension(&self) -> &'static str;",
          "documentation": "Returns the file extension for this format (without the dot).\n\n# Examples\n\n```\nuse forge_media::speech::AudioFormat;\n\nassert_eq!(AudioFormat::Mp3.extension(), \"mp3\");\nassert_eq!(AudioFormat::Wav.extension(), \"wav\");\nassert_eq!(AudioFormat::Ogg.extension(), \"ogg\");\nassert_eq!(AudioFormat::Flac.extension(), \"flac\");\n```"
        },
        {
          "name": "::SpeechOptions",
          "line": 133,
          "signature": "#[derive(Debug, Clone, Default, Serialize, Deserialize)]\npub struct SpeechOptions {\n/// The voice identifier to use (e.g., \"alloy\", \"echo\", \"nova\").\n\n/// `None` means the provider's default voice.\n\npub voice: Option<String>,\n/// The playback speed multiplier (e.g., 0.5 for half speed, 2.0 for double speed).\n\n/// `None` means the provider's default speed (typically 1.0).\n\npub speed: Option<f64>,\n/// Output audio format.\n\npub format: AudioFormat\n}",
          "documentation": "Configuration options for speech synthesis.\n\nControls the voice, playback speed, and output format of the synthesized audio.\nAll fields except `format` are optional; providers will use their own defaults\nfor unspecified values.\n\n# Examples\n\n```\nuse forge_media::speech::{AudioFormat, SpeechOptions};\n\nlet options = SpeechOptions {\n    voice: Some(\"alloy\".to_string()),\n    speed: Some(1.25),\n    format: AudioFormat::Mp3,\n};\nassert_eq!(options.voice.as_deref(), Some(\"alloy\"));\n```"
        },
        {
          "name": "::SpeechResult",
          "line": 163,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct SpeechResult {\n/// The raw audio bytes in the format specified by `mime_type`.\n\npub audio: Vec<u8>,\n/// The MIME type of the audio data (e.g., \"audio/mpeg\").\n\npub mime_type: String,\n/// The duration of the generated audio in seconds, if available.\n\n/// `None` if the provider does not report duration.\n\npub duration_seconds: Option<f64>\n}",
          "documentation": "The result of a speech synthesis operation.\n\nContains the raw audio bytes along with metadata about the generated speech.\n\n# Examples\n\n```\nuse forge_media::speech::SpeechResult;\n\nlet result = SpeechResult {\n    audio: vec![0xFF, 0xFB, 0x90, 0x00],\n    mime_type: \"audio/mpeg\".to_string(),\n    duration_seconds: Some(2.5),\n};\nassert_eq!(result.audio.len(), 4);\nassert_eq!(result.mime_type, \"audio/mpeg\");\nassert_eq!(result.duration_seconds, Some(2.5));\n```"
        },
        {
          "name": "::SpeechProvider",
          "line": 213,
          "signature": "#[async_trait]\npub trait SpeechProvider: Send + Sync {\n    /// Returns the model identifier (e.g., \"tts-1\", \"tts-1-hd\").\n    fn model_id(&self) -> &str;\n\n    /// Returns the provider name (e.g., \"openai\", \"elevenlabs\").\n    fn provider_name(&self) -> &str;\n\n    /// Synthesizes speech from text.\n    ///\n    /// # Arguments\n    ///\n    /// * `text` - The text to convert to speech.\n    /// * `options` - Configuration for voice, speed, and output format.\n    ///\n    /// # Returns\n    ///\n    /// A [`SpeechResult`] containing the generated audio bytes and metadata.\n    ///\n    /// # Errors\n    ///\n    /// * [`ForgeMediaError::SpeechFailed`] -- if the provider returns an error.\n    /// * [`ForgeMediaError::UnsupportedFormat`] -- if the requested format is not supported.\n    async fn speak(\n        &self,\n        text: &str,\n        options: &SpeechOptions,\n    ) -> Result<SpeechResult, ForgeMediaError>;\n}",
          "documentation": "A provider capable of synthesizing speech from text.\n\nImplementations of this trait connect to specific text-to-speech backends\n(e.g., OpenAI TTS, Google Cloud TTS, ElevenLabs). The provider is responsible\nfor translating the generic [`SpeechOptions`] into provider-specific API calls\nand returning the result as a [`SpeechResult`].\n\n# ANVIL Spec S6.3\n\nThe media interface is provider-agnostic. Agent code never imports a specific\nspeech provider -- it uses this trait through the Forge media API.\n\n# Examples\n\n```no_run\nuse async_trait::async_trait;\nuse forge_media::speech::{SpeechOptions, SpeechProvider, SpeechResult};\nuse forge_media::ForgeMediaError;\n\nstruct MySpeechProvider;\n\n#[async_trait]\nimpl SpeechProvider for MySpeechProvider {\n    fn model_id(&self) -> &str { \"my-tts-v1\" }\n    fn provider_name(&self) -> &str { \"my-provider\" }\n\n    async fn speak(\n        &self,\n        text: &str,\n        options: &SpeechOptions,\n    ) -> Result<SpeechResult, ForgeMediaError> {\n        Ok(SpeechResult {\n            audio: vec![0xFF, 0xFB, 0x90, 0x00],\n            mime_type: options.format.mime_type().to_string(),\n            duration_seconds: Some(1.5),\n        })\n    }\n}\n```"
        },
        {
          "name": "::speak",
          "line": 283,
          "signature": "pub async fn speak(\n    provider: &dyn SpeechProvider,\n    text: &str,\n    options: &SpeechOptions,\n) -> Result<SpeechResult, ForgeMediaError>;",
          "documentation": "Synthesizes speech from text using the specified provider.\n\nThis is the primary entry point for speech synthesis in the Forge SDK.\nIt delegates to the provider's `speak` method and emits telemetry spans\nfor observability.\n\n# ANVIL Spec S6.3\n\nImplements the `media.audio.speak` operation defined by the ANVIL\nmedia interface.\n\n# Arguments\n\n* `provider` - The speech synthesis provider to use.\n* `text` - The text to convert to speech.\n* `options` - Configuration for voice, speed, and output format.\n\n# Returns\n\nA [`SpeechResult`] containing the generated audio bytes, MIME type, and\noptional duration.\n\n# Errors\n\n* [`ForgeMediaError::SpeechFailed`] -- if the provider call fails.\n* [`ForgeMediaError::UnsupportedFormat`] -- if the requested format is not supported.\n\n# Examples\n\n```no_run\nuse forge_media::speech::{speak, SpeechOptions, SpeechProvider};\n\nasync fn example(provider: &dyn SpeechProvider) {\n    let options = SpeechOptions::default();\n    let result = speak(provider, \"Good morning!\", &options).await;\n    match result {\n        Ok(s) => println!(\"Audio: {} bytes\", s.audio.len()),\n        Err(e) => eprintln!(\"Failed: {e}\"),\n    }\n}\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-media/src/transcription.rs",
      "sha256": "0d553e0ce09c44ab7d4599d73d30579be9edb08e6f71a561b51d978df8a484a3",
      "artifactSha256": "f90dfa7483f2a31f15c1da12aff6a23ac381b9a2aaa31911f4467262272af811",
      "url": "/reference/source/forge-rs/crates/forge-media/src/transcription.rs.txt",
      "declarations": [
        {
          "name": "::TranscriptionSegment",
          "line": 54,
          "signature": "#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]\npub struct TranscriptionSegment {\n/// The start time of this segment in seconds from the beginning of the audio.\n\npub start: f64,\n/// The end time of this segment in seconds from the beginning of the audio.\n\npub end: f64,\n/// The transcribed text for this segment.\n\npub text: String\n}",
          "documentation": "A time-aligned segment of a transcription.\n\nRepresents a portion of the transcription with its start and end timestamps,\nenabling time-based navigation and subtitle generation.\n\n# Examples\n\n```\nuse forge_media::transcription::TranscriptionSegment;\n\nlet segment = TranscriptionSegment {\n    start: 0.0,\n    end: 2.5,\n    text: \"Hello, world!\".to_string(),\n};\nassert_eq!(segment.start, 0.0);\nassert_eq!(segment.end, 2.5);\nassert_eq!(segment.text, \"Hello, world!\");\n```"
        },
        {
          "name": "::TranscriptionSegment::duration",
          "line": 78,
          "signature": "pub fn duration(&self) -> f64;",
          "documentation": "Returns the duration of this segment in seconds.\n\n# Examples\n\n```\nuse forge_media::transcription::TranscriptionSegment;\n\nlet segment = TranscriptionSegment {\n    start: 1.0,\n    end: 3.5,\n    text: \"example\".to_string(),\n};\nassert!((segment.duration() - 2.5).abs() < f64::EPSILON);\n```"
        },
        {
          "name": "::TranscriptionOptions",
          "line": 101,
          "signature": "#[derive(Debug, Clone, Default, Serialize, Deserialize)]\npub struct TranscriptionOptions {\n/// An ISO 639-1 language code hint (e.g., \"en\", \"fr\", \"de\").\n\n/// `None` means the provider will auto-detect the language.\n\npub language: Option<String>,\n/// An optional prompt to guide the transcription model. Useful for providing\n\n/// context about domain-specific terminology or expected content.\n\n/// `None` means no guidance prompt.\n\npub prompt: Option<String>\n}",
          "documentation": "Configuration options for audio transcription.\n\nControls the language hint and optional prompt for guiding the transcription\nmodel. All fields are optional; providers will use their own defaults for\nunspecified values.\n\n# Examples\n\n```\nuse forge_media::transcription::TranscriptionOptions;\n\nlet options = TranscriptionOptions {\n    language: Some(\"en\".to_string()),\n    prompt: Some(\"Technical discussion about Rust programming\".to_string()),\n};\nassert_eq!(options.language.as_deref(), Some(\"en\"));\n```"
        },
        {
          "name": "::TranscriptionResult",
          "line": 142,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct TranscriptionResult {\n/// The full transcribed text.\n\npub text: String,\n/// The detected language as an ISO 639-1 code, if available.\n\npub language: Option<String>,\n/// The total duration of the audio in seconds, if available.\n\npub duration_seconds: Option<f64>,\n/// Time-aligned transcription segments. May be empty if the provider\n\n/// does not support segmented output.\n\npub segments: Vec<TranscriptionSegment>\n}",
          "documentation": "The result of an audio transcription operation.\n\nContains the full transcribed text along with optional metadata including\ndetected language, total duration, and time-aligned segments.\n\n# Examples\n\n```\nuse forge_media::transcription::{TranscriptionResult, TranscriptionSegment};\n\nlet result = TranscriptionResult {\n    text: \"Hello, this is a test.\".to_string(),\n    language: Some(\"en\".to_string()),\n    duration_seconds: Some(3.5),\n    segments: vec![\n        TranscriptionSegment {\n            start: 0.0,\n            end: 1.5,\n            text: \"Hello,\".to_string(),\n        },\n        TranscriptionSegment {\n            start: 1.5,\n            end: 3.5,\n            text: \" this is a test.\".to_string(),\n        },\n    ],\n};\nassert_eq!(result.text, \"Hello, this is a test.\");\nassert_eq!(result.segments.len(), 2);\n```"
        },
        {
          "name": "::TranscriptionProvider",
          "line": 198,
          "signature": "#[async_trait]\npub trait TranscriptionProvider: Send + Sync {\n    /// Returns the model identifier (e.g., \"whisper-1\", \"chirp-v2\").\n    fn model_id(&self) -> &str;\n\n    /// Returns the provider name (e.g., \"openai\", \"google\").\n    fn provider_name(&self) -> &str;\n\n    /// Transcribes audio data to text.\n    ///\n    /// # Arguments\n    ///\n    /// * `audio` - Raw audio bytes. The provider determines acceptable formats\n    ///   (e.g., WAV, MP3, FLAC, OGG).\n    /// * `options` - Configuration for language hint and guidance prompt.\n    ///\n    /// # Returns\n    ///\n    /// A [`TranscriptionResult`] containing the transcribed text and metadata.\n    ///\n    /// # Errors\n    ///\n    /// * [`ForgeMediaError::TranscriptionFailed`] -- if the provider returns an error.\n    /// * [`ForgeMediaError::UnsupportedFormat`] -- if the audio format is not supported.\n    async fn transcribe(\n        &self,\n        audio: &[u8],\n        options: &TranscriptionOptions,\n    ) -> Result<TranscriptionResult, ForgeMediaError>;\n}",
          "documentation": "A provider capable of transcribing audio data to text.\n\nImplementations of this trait connect to specific speech-to-text backends\n(e.g., OpenAI Whisper, Google Speech-to-Text, Deepgram). The provider is\nresponsible for translating the generic [`TranscriptionOptions`] into\nprovider-specific API calls and returning the result as a\n[`TranscriptionResult`].\n\n# ANVIL Spec S6.3\n\nThe media interface is provider-agnostic. Agent code never imports a specific\ntranscription provider -- it uses this trait through the Forge media API.\n\n# Examples\n\n```no_run\nuse async_trait::async_trait;\nuse forge_media::transcription::{\n    TranscriptionOptions, TranscriptionProvider, TranscriptionResult,\n};\nuse forge_media::ForgeMediaError;\n\nstruct MyTranscriptionProvider;\n\n#[async_trait]\nimpl TranscriptionProvider for MyTranscriptionProvider {\n    fn model_id(&self) -> &str { \"my-whisper-v1\" }\n    fn provider_name(&self) -> &str { \"my-provider\" }\n\n    async fn transcribe(\n        &self,\n        audio: &[u8],\n        options: &TranscriptionOptions,\n    ) -> Result<TranscriptionResult, ForgeMediaError> {\n        Ok(TranscriptionResult {\n            text: \"transcribed text\".to_string(),\n            language: Some(\"en\".to_string()),\n            duration_seconds: Some(5.0),\n            segments: Vec::new(),\n        })\n    }\n}\n```"
        },
        {
          "name": "::transcribe",
          "line": 273,
          "signature": "pub async fn transcribe(\n    provider: &dyn TranscriptionProvider,\n    audio: &[u8],\n    options: &TranscriptionOptions,\n) -> Result<TranscriptionResult, ForgeMediaError>;",
          "documentation": "Transcribes audio data to text using the specified provider.\n\nThis is the primary entry point for audio transcription in the Forge SDK.\nIt delegates to the provider's `transcribe` method and emits telemetry\nspans for observability.\n\n# ANVIL Spec S6.3\n\nImplements the `media.audio.transcribe` operation defined by the ANVIL\nmedia interface.\n\n# Arguments\n\n* `provider` - The transcription provider to use.\n* `audio` - Raw audio bytes.\n* `options` - Configuration for language hint and guidance prompt.\n\n# Returns\n\nA [`TranscriptionResult`] containing the transcribed text, detected language,\nduration, and time-aligned segments.\n\n# Errors\n\n* [`ForgeMediaError::TranscriptionFailed`] -- if the provider call fails.\n* [`ForgeMediaError::UnsupportedFormat`] -- if the audio format is not supported.\n\n# Examples\n\n```no_run\nuse forge_media::transcription::{transcribe, TranscriptionOptions, TranscriptionProvider};\n\nasync fn example(provider: &dyn TranscriptionProvider) {\n    let audio_bytes = vec![0u8; 1024]; // sample audio bytes\n    let options = TranscriptionOptions {\n        language: Some(\"en\".to_string()),\n        prompt: None,\n    };\n    let result = transcribe(provider, &audio_bytes, &options).await;\n    match result {\n        Ok(t) => println!(\"Text: {}\", t.text),\n        Err(e) => eprintln!(\"Failed: {e}\"),\n    }\n}\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-media/src/video.rs",
      "sha256": "f35c9ead40a7fb460adbdf996b23d715321718cdb6a625fb57a1b5d1b629073e",
      "artifactSha256": "43263a766ea39270dc9d34b6534327b2091a2a481a0e3e6adf5fa1d115c952cb",
      "url": "/reference/source/forge-rs/crates/forge-media/src/video.rs.txt",
      "declarations": [
        {
          "name": "::VideoFormat",
          "line": 52,
          "signature": "#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]\n#[serde(rename_all = \"lowercase\")]\npub enum VideoFormat {\n    /// MP4 \u2014 widely supported video container format (typically H.264/AAC).\n    #[default]\n    Mp4,\n    /// WebM \u2014 open video format (typically VP8/VP9/Opus).\n    Webm,\n}",
          "documentation": "The output format for generated videos.\n\nDetermines the container format and encoding used for the video bytes\nin [`VideoResult::data`].\n\n# Examples\n\n```\nuse forge_media::video::VideoFormat;\n\nlet format = VideoFormat::Mp4;\nassert_eq!(format.mime_type(), \"video/mp4\");\nassert_eq!(format.extension(), \"mp4\");\n```"
        },
        {
          "name": "::VideoFormat::mime_type",
          "line": 75,
          "signature": "pub fn mime_type(&self) -> &'static str;",
          "documentation": "Returns the MIME type string for this format.\n\n# Returns\n\nA static MIME type string suitable for HTTP `Content-Type` headers.\n\n# Examples\n\n```\nuse forge_media::video::VideoFormat;\n\nassert_eq!(VideoFormat::Mp4.mime_type(), \"video/mp4\");\nassert_eq!(VideoFormat::Webm.mime_type(), \"video/webm\");\n```"
        },
        {
          "name": "::VideoFormat::extension",
          "line": 92,
          "signature": "pub fn extension(&self) -> &'static str;",
          "documentation": "Returns the file extension for this format (without the dot).\n\n# Examples\n\n```\nuse forge_media::video::VideoFormat;\n\nassert_eq!(VideoFormat::Mp4.extension(), \"mp4\");\nassert_eq!(VideoFormat::Webm.extension(), \"webm\");\n```"
        },
        {
          "name": "::VideoOptions",
          "line": 127,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct VideoOptions {\n/// Desired width in pixels.\n\npub width: u32,\n/// Desired height in pixels.\n\npub height: u32,\n/// Desired video duration in seconds.\n\npub duration_seconds: f64,\n/// Output video format.\n\npub format: VideoFormat\n}",
          "documentation": "Configuration options for video generation.\n\nControls the output dimensions, duration, and format of generated videos.\nAll fields except `format` use sensible defaults; providers may impose their\nown limits on dimensions and duration.\n\n# Examples\n\n```\nuse forge_media::video::{VideoFormat, VideoOptions};\n\nlet options = VideoOptions {\n    width: 1920,\n    height: 1080,\n    duration_seconds: 10.0,\n    format: VideoFormat::Mp4,\n};\nassert_eq!(options.width, 1920);\nassert_eq!(options.duration_seconds, 10.0);\n```"
        },
        {
          "name": "::VideoResult",
          "line": 170,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct VideoResult {\n/// The raw video bytes in the format specified by `mime_type`.\n\npub data: Vec<u8>,\n/// The MIME type of the video data (e.g., \"video/mp4\").\n\npub mime_type: String,\n/// The duration of the generated video in seconds.\n\npub duration_seconds: f64,\n/// The width of the generated video in pixels.\n\npub width: u32,\n/// The height of the generated video in pixels.\n\npub height: u32\n}",
          "documentation": "The result of a video generation operation.\n\nContains the raw video bytes along with metadata about the generated video.\n\n# Examples\n\n```\nuse forge_media::video::VideoResult;\n\nlet result = VideoResult {\n    data: vec![0x00, 0x00, 0x00, 0x1C],\n    mime_type: \"video/mp4\".to_string(),\n    duration_seconds: 5.0,\n    width: 1280,\n    height: 720,\n};\nassert_eq!(result.data.len(), 4);\nassert_eq!(result.mime_type, \"video/mp4\");\nassert_eq!(result.duration_seconds, 5.0);\n```"
        },
        {
          "name": "::VideoProvider",
          "line": 225,
          "signature": "#[async_trait]\npub trait VideoProvider: Send + Sync {\n    /// Returns the model identifier (e.g., \"sora-1\", \"runway-gen2\").\n    fn model_id(&self) -> &str;\n\n    /// Returns the provider name (e.g., \"openai\", \"runway\").\n    fn provider_name(&self) -> &str;\n\n    /// Generates a video from a text prompt.\n    ///\n    /// # Arguments\n    ///\n    /// * `prompt` - The text description of the video to generate.\n    /// * `options` - Configuration for output dimensions, duration, and format.\n    ///\n    /// # Returns\n    ///\n    /// A [`VideoResult`] containing the generated video bytes and metadata.\n    ///\n    /// # Errors\n    ///\n    /// * [`ForgeMediaError::VideoFailed`] -- if the provider returns an error.\n    /// * [`ForgeMediaError::UnsupportedFormat`] -- if the requested format is not supported.\n    async fn generate_video(\n        &self,\n        prompt: &str,\n        options: &VideoOptions,\n    ) -> Result<VideoResult, ForgeMediaError>;\n}",
          "documentation": "A provider capable of generating videos from text prompts.\n\nImplementations of this trait connect to specific video generation backends\n(e.g., OpenAI Sora, Runway, Pika). The provider is responsible for translating\nthe generic [`VideoOptions`] into provider-specific API calls and returning\nthe result as a [`VideoResult`].\n\n# ANVIL Spec S6.3\n\nThe media interface is provider-agnostic. Agent code never imports a specific\nvideo provider -- it uses this trait through the Forge media API.\n\n# Examples\n\n```no_run\nuse async_trait::async_trait;\nuse forge_media::video::{VideoOptions, VideoProvider, VideoResult};\nuse forge_media::ForgeMediaError;\n\nstruct MyVideoProvider;\n\n#[async_trait]\nimpl VideoProvider for MyVideoProvider {\n    fn model_id(&self) -> &str { \"my-video-v1\" }\n    fn provider_name(&self) -> &str { \"my-provider\" }\n\n    async fn generate_video(\n        &self,\n        prompt: &str,\n        options: &VideoOptions,\n    ) -> Result<VideoResult, ForgeMediaError> {\n        Ok(VideoResult {\n            data: vec![0x00, 0x00, 0x00, 0x1C],\n            mime_type: options.format.mime_type().to_string(),\n            duration_seconds: options.duration_seconds,\n            width: options.width,\n            height: options.height,\n        })\n    }\n}\n```"
        },
        {
          "name": "::generate_video",
          "line": 294,
          "signature": "pub async fn generate_video(\n    provider: &dyn VideoProvider,\n    prompt: &str,\n    options: &VideoOptions,\n) -> Result<VideoResult, ForgeMediaError>;",
          "documentation": "Generates a video from a text prompt using the specified provider.\n\nThis is the primary entry point for video generation in the Forge SDK.\nIt delegates to the provider's `generate_video` method and emits telemetry\nspans for observability.\n\n# ANVIL Spec S6.3\n\nImplements the `media.video.generate` operation defined by the ANVIL\nmedia interface.\n\n# Arguments\n\n* `provider` - The video generation provider to use.\n* `prompt` - The text description of the video to generate.\n* `options` - Configuration for output dimensions, duration, and format.\n\n# Returns\n\nA [`VideoResult`] containing the generated video bytes and metadata.\n\n# Errors\n\n* [`ForgeMediaError::VideoFailed`] -- if the provider call fails.\n* [`ForgeMediaError::UnsupportedFormat`] -- if the requested format is not supported.\n\n# Examples\n\n```no_run\nuse forge_media::video::{generate_video, VideoOptions, VideoProvider};\n\nasync fn example(provider: &dyn VideoProvider) {\n    let options = VideoOptions::default();\n    let result = generate_video(provider, \"a cat playing with yarn\", &options).await;\n    match result {\n        Ok(v) => println!(\"Video: {}x{}, {:.1}s\", v.width, v.height, v.duration_seconds),\n        Err(e) => eprintln!(\"Failed: {e}\"),\n    }\n}\n```"
        }
      ]
    }
  ]
}
