Crates.io | oai_rs |
lib.rs | oai_rs |
version | 0.1.3 |
source | src |
created_at | 2022-12-09 17:03:04.810068 |
updated_at | 2023-10-22 18:48:29.489157 |
description | An async rust library that's a wrapper for the OpenAI API |
homepage | https://github.com/motorlatitude/oai_rs |
repository | https://github.com/motorlatitude/oai_rs |
max_upload_size | |
id | 733376 |
size | 415,176 |
An async rust library that's a wrapper for the OpenAI API.
Handles some of the following endpoints of the API:
Models
Edits
Images
Embeddings
Files
Fine-tunes
Moderations
Simply add oai_rs = "0.1.2"
to your cargo.toml file. The API key should be provided as an enivormental variable using OPENAI_API_KEY
.
Simple example to complete a prompt string.
use oai_rs::{completions, models};
async {
let completions = completions::build(models::CompletionModels::TEXT_DAVINCI_003)
.prompt("Ice cream or cookies?")
.max_tokens(32)
.complete()
.await;
println!("{:?}", completions);
};