Crate gpt3_rs

Source
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 = request.request(&client).await.unwrap();
    let answer = &response.choices[0].text;

    println!("{answer}");
}

Modules§

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

Structs§

Client
A client for interacting with the OpenAi api

Enums§

Model

Traits§

Request
Sends the request to the OpenAi api