Skip to content

A library to interface with the OpenAI API

License

Notifications You must be signed in to change notification settings

QuantumBear/openai-rust

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openai-rust

Test Status Crates.io docs.rs

This is an unofficial library to interact with the Openai-API. The goal of this crate is to support the entire api.

Current features:

Example usage

// Here we will use the chat completion endpoint
let client = openai_rust::Client::new(&std::env::var("OPENAI_API_KEY").unwrap());
let args = openai_rust::chat::ChatArguments::new("gpt-3.5-turbo", vec![
    openai_rust::chat::Message {
        role: "user".to_owned(),
        content: "Hello GPT!".to_owned(),
    }
]);
let res = client.create_chat(args).await.unwrap();
println!("{}", res);

You can run this code as an example with OPENAI_API_KEY=(your key) cargo run --example chat.

Checkout the examples directory for more usage examples. You can find documentation on docs.rs.

Projects using openai-rust

About

A library to interface with the OpenAI API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%