feat: add chain method to create Request instance

This commit is contained in:
Night Cruising
2023-10-17 15:14:31 +08:00
parent f1f1fa7e86
commit a9be9efdfe
16 changed files with 402 additions and 135 deletions

View File

@ -4,11 +4,12 @@ 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 {
model: "text-embedding-ada-002".to_string(),
input: "story time".to_string(),
user: Option::None,
};
let req = EmbeddingRequest::new(
"text-embedding-ada-002".to_string(),
"story time".to_string(),
);
let result = client.embedding(req)?;
println!("{:?}", result.data);