Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
scald committed Nov 25, 2024
1 parent e7ae05d commit 2947a52
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 8 additions & 2 deletions src/prompts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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]
Expand Down
4 changes: 1 addition & 3 deletions src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2947a52

Please sign in to comment.