mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-22 15:15:34 +00:00
chore: update examples
This commit is contained in:
@ -2,8 +2,7 @@ use openai_api_rs::v1::api::Client;
|
||||
use openai_api_rs::v1::chat_completion::{self, ChatCompletionRequest};
|
||||
use std::env;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let client = Client::new(env::var("OPENAI_API_KEY").unwrap().to_string());
|
||||
let req = ChatCompletionRequest {
|
||||
model: chat_completion::GPT4.to_string(),
|
||||
@ -26,7 +25,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
logit_bias: None,
|
||||
user: None,
|
||||
};
|
||||
let result = client.chat_completion(req).await?;
|
||||
let result = client.chat_completion(req)?;
|
||||
println!("{:?}", result.choices[0].message.content);
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user