Skip to content

Commit

Permalink
Add static BASE_URL getter/setter with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
netr committed Oct 18, 2023
1 parent 6993f80 commit 116b3b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/chat_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ use dotenvy::dotenv;

use openai::{
chat::{ChatCompletion, ChatCompletionMessage, ChatCompletionMessageRole},
set_key,
set_base_url, set_key,
};

#[tokio::main]
async fn main() {
// Make sure you have a file named `.env` with the `OPENAI_KEY` environment variable defined!
dotenv().unwrap();
set_key(env::var("OPENAI_KEY").unwrap());
set_base_url(env::var("OPENAI_BASE_URL").unwrap_or_default());

let mut messages = vec![ChatCompletionMessage {
role: ChatCompletionMessageRole::System,
Expand Down

0 comments on commit 116b3b7

Please sign in to comment.