Fix input type for embedding

This commit is contained in:
Dongri Jin
2024-11-09 08:44:15 +09:00
parent 0a9f65168b
commit 51b9491de9
2 changed files with 12 additions and 3 deletions

View File

@ -8,7 +8,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = OpenAIClient::new(env::var("OPENAI_API_KEY").unwrap().to_string());
let mut req =
EmbeddingRequest::new(TEXT_EMBEDDING_3_SMALL.to_string(), "story time".to_string());
EmbeddingRequest::new(TEXT_EMBEDDING_3_SMALL.to_string(), vec!["story time".to_string(), "Once upon a time".to_string()]);
req.dimensions = Some(10);
let result = client.embedding(req).await?;