#![warn(missing_docs)]
#![warn(clippy::all)]
#![warn(clippy::pedantic)]
#![allow(clippy::module_name_repetitions)]
pub mod domain;
pub mod application;
pub mod infrastructure;
pub mod normalization;
pub mod quantization;
pub use domain::entities::{
Embedding, EmbeddingId, EmbeddingModel, EmbeddingMetadata,
StorageTier, ModelVersion, InputSpecification,
};
pub use domain::repository::EmbeddingRepository;
pub use application::services::EmbeddingService;
pub use infrastructure::model_manager::{ModelManager, ModelConfig};
pub use infrastructure::onnx_inference::OnnxInference;
pub const EMBEDDING_DIM: usize = 1536;
pub const TARGET_SAMPLE_RATE: u32 = 32000;
pub const TARGET_WINDOW_SECONDS: f32 = 5.0;
pub const TARGET_WINDOW_SAMPLES: usize = 160_000;
pub const MEL_BINS: usize = 128;
pub const MEL_FRAMES: usize = 500;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub type Result<T> = std::result::Result<T, EmbeddingError>;
#[derive(Debug, thiserror::Error)]
pub enum EmbeddingError {
#[error("Model error: {0}")]
Model(#[from] infrastructure::model_manager::ModelError),
#[error("Inference error: {0}")]
Inference(#[from] infrastructure::onnx_inference::InferenceError),
#[error("Validation error: {0}")]
Validation(String),
#[error("Invalid dimensions: expected {expected}, got {actual}")]
InvalidDimensions {
expected: usize,
actual: usize,
},
#[error("Repository error: {0}")]
Repository(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Checksum mismatch: expected {expected}, got {actual}")]
ChecksumMismatch {
expected: String,
actual: String,
},
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_constants() {
assert_eq!(EMBEDDING_DIM, 1536);
assert_eq!(TARGET_SAMPLE_RATE, 32000);
assert_eq!(TARGET_WINDOW_SAMPLES, 160_000);
assert_eq!(MEL_BINS, 128);
assert_eq!(MEL_FRAMES, 500);
}
}