From 2947a52282bb430f099623c8903bfa33e1d805aa Mon Sep 17 00:00:00 2001 From: scald <1215913+scald@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:51:47 +0200 Subject: [PATCH] formatting --- src/processor.rs | 2 +- src/prompts.rs | 10 ++++++++-- src/providers/mod.rs | 4 +--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/processor.rs b/src/processor.rs index 69fe81c..91e434d 100644 --- a/src/processor.rs +++ b/src/processor.rs @@ -34,7 +34,7 @@ impl ImageProcessor { /// Some("moondream".to_string()), /// None /// ); - /// + /// /// # async fn example() { /// let image_data = std::fs::read("image.jpg").unwrap(); /// let (analysis, token_usage) = processor.process(&image_data).await.unwrap(); diff --git a/src/prompts.rs b/src/prompts.rs index 9b4b1b5..a580f7e 100644 --- a/src/prompts.rs +++ b/src/prompts.rs @@ -160,7 +160,11 @@ impl ImagePrompt { PromptFormat::PlatformSpecific(platform) => format!("Analyze this {} content with platform-specific considerations.", platform), }; - Self { text, format, config: AnalysisConfig::default() } + Self { + text, + format, + config: AnalysisConfig::default(), + } } pub fn to_openai_content(&self) -> serde_json::Value { @@ -217,7 +221,9 @@ mod tests { ]); let prompt = ImagePrompt::new(format); // Update assertion to match the actual prompt text format - assert!(prompt.text.contains("Analyze this image for the following aspects:")); + assert!(prompt + .text + .contains("Analyze this image for the following aspects:")); } #[test] diff --git a/src/providers/mod.rs b/src/providers/mod.rs index 73f9df4..440dc90 100644 --- a/src/providers/mod.rs +++ b/src/providers/mod.rs @@ -7,15 +7,13 @@ pub use ollama::OllamaProvider; pub use openai::OpenAIProvider; use serde::Serialize; -#[derive(Debug, Clone, Serialize)] -#[derive(Default)] +#[derive(Debug, Clone, Serialize, Default)] pub struct TokenUsage { pub prompt_tokens: usize, pub completion_tokens: usize, pub total_tokens: usize, } - #[derive(Debug, Clone, Copy)] pub enum AIProvider { OpenAI,