Add dimensions parameter

This commit is contained in:
Dongri Jin
2024-01-29 05:03:13 +09:00
parent 2e334e7087
commit f1685c96bd
2 changed files with 6 additions and 1 deletions

View File

@ -6,7 +6,9 @@ use std::env;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new(env::var("OPENAI_API_KEY").unwrap().to_string());
let req = EmbeddingRequest::new(TEXT_EMBEDDING_3_SMALL.to_string(), "story time".to_string());
let mut req =
EmbeddingRequest::new(TEXT_EMBEDDING_3_SMALL.to_string(), "story time".to_string());
req.dimensions = Some(10);
let result = client.embedding(req)?;
println!("{:?}", result.data);