Crates.io | openai_client |
lib.rs | openai_client |
version | 0.1.0 |
source | src |
created_at | 2022-12-23 19:27:18.084258 |
updated_at | 2022-12-23 19:27:18.084258 |
description | Client library for using the OpenAi Api |
homepage | |
repository | |
max_upload_size | |
id | 744692 |
size | 85,288 |
openai_client
provides configuration, models an a http client for working with
the API of OpenAi in Rust.
[dependencies]
openai_client = "0.1.0"
Or via git:
[dependencies.redis_ts]
git = "https://github.com/tompro/openai_client.git"
use openai_client::*;
// Create client
let client = OpenAiClient::new(OpenAiConfig::new("<ACCESS_TOKEN>"));
// Create request
let request = EditRequestBuilder::default()
.model("text-davinci-edit-001")
.input("What day of the wek is it?")
.instruction("Fix the spelling mistakes")
.build()
.unwrap();
// Send request
let result = client.create_edit(request).await?;