chat/
chat_example.rs

1// Here we will use the chat completion endpoint
2use openai_rust;
3
4#[tokio::main]
5async fn main() {
6    let client = openai_rust::Client::new(&std::env::var("OPENAI_API_KEY").unwrap());
7    let args = openai_rust::chat::ChatArguments::new(
8        "gpt-3.5-turbo",
9        vec![openai_rust::chat::Message {
10            role: "user".to_owned(),
11            content: "Hello GPT!".to_owned(),
12        }],
13    );
14    let res = client.create_chat(args).await.unwrap();
15    println!("{}", res);
16}