Skip to content

Commit

Permalink
remove test
Browse files Browse the repository at this point in the history
  • Loading branch information
chenwanqq committed Feb 27, 2024
1 parent 0c47741 commit 48e1903
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions src/embedding/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,37 +81,4 @@ impl EmbeddingEndpoint {

Ok(EmbeddingResponse::new(response))
}
}

#[cfg(test)]
mod tests {
use super::super::model::EmbeddingModel;
use super::EmbeddingEndpoint;
use tokio::runtime::Runtime;
#[test]
fn test_embedding() {
let embedding = EmbeddingEndpoint::new(EmbeddingModel::EmbeddingV1).unwrap();
let input = vec![
"你好".to_string(),
"你叫什么名字".to_string(),
"你是谁".to_string(),
];
let embedding_response = embedding.invoke(input, None).unwrap();
let embedding_results = embedding_response.get_embedding_results().unwrap();
println!("{},{}", embedding_results.len(), embedding_results[0].len());
}

#[test]
fn test_async_embedding() {
let embedding = EmbeddingEndpoint::new(EmbeddingModel::EmbeddingV1).unwrap();
let input = vec![
"你好".to_string(),
"你叫什么名字".to_string(),
"你是谁".to_string(),
];
let rt = Runtime::new().unwrap();
let embedding_response = rt.block_on(embedding.ainvoke(input, None)).unwrap();
let embedding_results = embedding_response.get_embedding_results().unwrap();
println!("{},{}", embedding_results.len(), embedding_results[0].len());
}
}
}

0 comments on commit 48e1903

Please sign in to comment.