use std::error::Error;
use openairs::{
client,
models::{self},
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let open_ai_client = client::OpenAIClient::new(
std::env::var("OPENAI_API_KEY").expect("Could not get api token"),
);
let input = "What day of the wek is it?";
let instruction = "Fix the spelling mistakes";
println!("Input: {}", input);
let model = models::TEXT_DAVINCI_EDIT_001;
let response = open_ai_client.edit(&model, input, instruction).await?;
println!("{}", response.choices[0].text);
Ok(())
}