@@ -7,7 +7,7 @@ Check out the [docs.rs](https://docs.rs/openai-api-rs/).
77Cargo.toml
88``` toml
99[dependencies ]
10- openai-api-rs = " 2.0.5 "
10+ openai-api-rs = " 2.1.0 "
1111```
1212
1313## Usage
@@ -33,8 +33,9 @@ let client = Client::new(env::var("OPENAI_API_KEY").unwrap().to_string());
3333### Create request
3434``` rust
3535use openai_api_rs :: v1 :: chat_completion :: {self , ChatCompletionRequest };
36+ use openai_api_rs :: v1 :: common :: GPT4 ;
3637let req = ChatCompletionRequest :: new (
37- chat_completion :: GPT4 . to_string (),
38+ GPT4 . to_string (),
3839 vec! [chat_completion :: ChatCompletionMessage {
3940 role : chat_completion :: MessageRole :: user ,
4041 content : String :: from (" Hello OpenAI!" ),
@@ -52,12 +53,13 @@ println!("{:?}", result.choices[0].text);
5253``` rust
5354use openai_api_rs :: v1 :: api :: Client ;
5455use openai_api_rs :: v1 :: chat_completion :: {self , ChatCompletionRequest };
56+ use openai_api_rs :: v1 :: common :: GPT4 ;
5557use std :: env;
5658
5759fn main () -> Result <(), Box <dyn std :: error :: Error >> {
5860 let client = Client :: new (env :: var (" OPENAI_API_KEY" ). unwrap (). to_string ());
5961 let req = ChatCompletionRequest :: new (
60- chat_completion :: GPT4 . to_string (),
62+ GPT4 . to_string (),
6163 vec! [chat_completion :: ChatCompletionMessage {
6264 role : chat_completion :: MessageRole :: user ,
6365 content : String :: from (" What is Bitcoin?" ),
@@ -85,6 +87,7 @@ Check out the [full API documentation](https://platform.openai.com/docs/api-refe
8587- [x] [ Fine-tunes] ( https://platform.openai.com/docs/api-reference/fine-tunes )
8688- [x] [ Moderations] ( https://platform.openai.com/docs/api-reference/moderations )
8789- [x] [ Function calling] ( https://platform.openai.com/docs/guides/gpt/function-calling )
90+ - [x] [ Assistants] ( https://platform.openai.com/docs/assistants/overview )
8891
8992## License
9093This project is licensed under [ MIT license] ( https://github.com/dongri/openai-api-rs/blob/main/LICENSE ) .
0 commit comments