Skip to content

Commit

Permalink
v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongri Jin committed Nov 11, 2023
1 parent 075acf5 commit e09ea65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "openai-api-rs"
version = "2.0.5"
version = "2.1.0"
edition = "2021"
authors = ["Dongri Jin <[email protected]>"]
license = "MIT"
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Check out the [docs.rs](https://docs.rs/openai-api-rs/).
Cargo.toml
```toml
[dependencies]
openai-api-rs = "2.0.5"
openai-api-rs = "2.1.0"
```

## Usage
Expand All @@ -33,8 +33,9 @@ let client = Client::new(env::var("OPENAI_API_KEY").unwrap().to_string());
### Create request
```rust
use openai_api_rs::v1::chat_completion::{self, ChatCompletionRequest};
use openai_api_rs::v1::common::GPT4;
let req = ChatCompletionRequest::new(
chat_completion::GPT4.to_string(),
GPT4.to_string(),
vec![chat_completion::ChatCompletionMessage {
role: chat_completion::MessageRole::user,
content: String::from("Hello OpenAI!"),
Expand All @@ -52,12 +53,13 @@ println!("{:?}", result.choices[0].text);
```rust
use openai_api_rs::v1::api::Client;
use openai_api_rs::v1::chat_completion::{self, ChatCompletionRequest};
use openai_api_rs::v1::common::GPT4;
use std::env;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new(env::var("OPENAI_API_KEY").unwrap().to_string());
let req = ChatCompletionRequest::new(
chat_completion::GPT4.to_string(),
GPT4.to_string(),
vec![chat_completion::ChatCompletionMessage {
role: chat_completion::MessageRole::user,
content: String::from("What is Bitcoin?"),
Expand Down Expand Up @@ -85,6 +87,7 @@ Check out the [full API documentation](https://platform.openai.com/docs/api-refe
- [x] [Fine-tunes](https://platform.openai.com/docs/api-reference/fine-tunes)
- [x] [Moderations](https://platform.openai.com/docs/api-reference/moderations)
- [x] [Function calling](https://platform.openai.com/docs/guides/gpt/function-calling)
- [x] [Assistants](https://platform.openai.com/docs/assistants/overview)

## License
This project is licensed under [MIT license](https://github.com/dongri/openai-api-rs/blob/main/LICENSE).

0 comments on commit e09ea65

Please sign in to comment.