stt-cli 0.2.1

Speech to text Cli using Groq API and OpenAI API
// --- Pipeline Types ---
// This module defines the core types used throughout the audio processing pipeline.
// Each type is documented for clarity and future extensibility.

/// Represents a chunk of audio data, typically a fixed-duration vector of samples.
#[derive(Debug, Clone)]
pub struct AudioChunk {
    /// Timestamp when the chunk was created.
    pub timestamp: std::time::SystemTime,
    /// Audio samples (mono, f32 PCM).
    pub data: Vec<f32>,
    /// Optional speech detection result.
    pub is_speech: Option<bool>,
}

/// Request type for the pipeline, wraps an AudioChunk.
#[derive(Debug, Clone)]
pub struct AudioRequest(pub AudioChunk);

/// Request type for the WAV conversion layer, wraps WAV bytes.
#[derive(Debug, Clone)]
pub struct WavAudioRequest {
    /// WAV-encoded audio data.
    pub wav_data: Vec<u8>,
    /// Original timestamp for tracking.
    pub timestamp: std::time::SystemTime,
}

/// Response type for the pipeline, wraps processed data.
#[derive(Debug, Clone)]
pub struct AudioResponse {
    /// The result of pipeline processing (e.g., transcription text).
    pub result_data: ProcessedData,
    /// Timestamp for tracking.
    pub original_timestamp: std::time::SystemTime,
}

/// Enum for all possible processed data results.
#[derive(Debug, Clone)]
pub enum ProcessedData {
    /// Transcription result as text.
    Transcription(String),
    // Other result types can be added here.
}

/// Error type for pipeline processing.
#[derive(Debug, thiserror::Error)]
pub enum PipelineError {
    #[error("WAV conversion failed: {0}")]
    WavConversionError(String),
    #[error("Transcription failed: {0}")]
    TranscriptionError(String),
    #[error("Unknown error: {0}")]
    UnknownError(String),
}