drfoo 0.1.3

A rust OpenAI ChatGPT framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use drfoo::*;
use std::env;

#[tokio::main]
async fn main() {
    drfoo::init_logger();
    let client = Client::new(env::var("OPENAI_API_KEY").unwrap().into());

    let prompt = String::from("In 6 months, here's what's going to happen:");
    let request = Completion::new().with_prompt(prompt).with_max_tokens(100);

    let response = client.do_completion(&request).await.unwrap();
    println!("Response: {:#?}", response);
}