Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
santiagomed committed Oct 26, 2023
1 parent 39ef296 commit 93c398d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/llm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use std::fmt::Display;
use anyhow::Result;
use candle_core::{Device, Result as CandleResult, Tensor};

use crate::prompt::Prompt;
use self::openai::OpenAIEmbeddingResponse;
use crate::prompt::Prompt;

/// Generate with context trait is used to execute an LLM using a context and a prompt template.
/// The context is a previously created context using the Context struct. The prompt template
Expand Down
5 changes: 3 additions & 2 deletions src/llm/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ impl EmbeddingTrait for OpenAI {
#[cfg(test)]
mod test {
use super::*;
use crate::prompt;
use crate::prompt::TemplateEngine;
use crate::template;
use std::collections::HashMap;
Expand Down Expand Up @@ -299,8 +300,8 @@ mod test {
#[tokio::test]
async fn test_embeddings() {
let client = OpenAI::new();
let content = "This is a test".to_string();
let res = client.generate_embedding(Box::new(content)).await.unwrap();
let content = prompt!("This is a test");
let res = client.generate_embedding(content).await.unwrap();
assert!(res.data[0].embedding.len() > 0);
}
}

0 comments on commit 93c398d

Please sign in to comment.