Skip to content

Commit feb9495

Browse files
committed
add support for org and project official env vars
1 parent a78cc34 commit feb9495

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

async-openai/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export OPENAI_API_KEY='sk-...'
5757
$Env:OPENAI_API_KEY='sk-...'
5858
```
5959

60+
Other official enviroment variables supported are: `OPENAI_ADMIN_KEY`, `OPENAI_ORG_ID`, `OPENAI_PROJECT_ID`
61+
6062
- Visit [examples](https://github.com/64bit/async-openai/tree/main/examples) directory on how to use `async-openai`.
6163
- Visit [docs.rs/async-openai](https://docs.rs/async-openai) for docs.
6264

async-openai/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ impl Default for OpenAIConfig {
7979
})
8080
.unwrap_or_default()
8181
.into(),
82-
org_id: Default::default(),
83-
project_id: Default::default(),
82+
org_id: std::env::var("OPENAI_ORG_ID").unwrap_or_default(),
83+
project_id: std::env::var("OPENAI_PROJECT_ID").unwrap_or_default(),
8484
custom_headers: HeaderMap::new(),
8585
}
8686
}

0 commit comments

Comments
 (0)