File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -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 = " 0.1 "
10+ openai-api-rs = " 1.0 "
1111```
1212
1313## Usage
@@ -56,7 +56,7 @@ let req = ChatCompletionRequest {
5656
5757### Send request
5858``` rust
59- let result = client . completion (req ). await ? ;
59+ let result = client . completion (req )? ;
6060println! (" {:?}" , result . choices[0 ]. text);
6161```
6262
@@ -66,8 +66,7 @@ use openai_api_rs::v1::api::Client;
6666use openai_api_rs :: v1 :: chat_completion :: {self , ChatCompletionRequest };
6767use std :: env;
6868
69- #[tokio:: main]
70- async fn main () -> Result <(), Box <dyn std :: error :: Error >> {
69+ fn main () -> Result <(), Box <dyn std :: error :: Error >> {
7170 let client = Client :: new (env :: var (" OPENAI_API_KEY" ). unwrap (). to_string ());
7271 let req = ChatCompletionRequest {
7372 model : chat_completion :: GPT4 . to_string (),
@@ -90,7 +89,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
9089 logit_bias : None ,
9190 user : None ,
9291 };
93- let result = client . chat_completion (req ). await ? ;
92+ let result = client . chat_completion (req )? ;
9493 println! (" {:?}" , result . choices[0 ]. message. content);
9594 Ok (())
9695}
You can’t perform that action at this time.
0 commit comments