Expand description

gpt3_rs

This crate is for interacting with OpenAi’s gpt-3.

Warning

There are a few apis missing and the documentation is incomplete

Examples

#[tokio::main]
async fn main() {
    let token = std::env::var("GPT_API_TOKEN").unwrap();

    let client = Client::new(token);

    let request = completions::Builder::default()
        .model(Model::Babbage)
        .prompt("what is 1 + 2?".into())
        .build()
        .unwrap();

    let response = client.request(&request).await.unwrap();
    let answer = &response.choices[0].text;

    println!("{answer}");
}

Modules

This module other modules that are used to interact with the api

Structs

A client for interacting with the OpenAi api

Enums