-
-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
The chatgpt.openai_api_key config option should be optional imo, since local OpenAI-compatible models (usually) don't need it. I'm using LM Studio and had to set that option to empty string. Otherwise getting this error:
Can not find the openai api key
You need to define one whether in the configuration file or as an environment variable
I think changing https://github.com/pythops/tenere/blob/15560b8ec/src/chatgpt.rs#L28-L41 to the following should work:
let openai_api_key = match std::env::var("OPENAI_API_KEY") {
Ok(key) => key,
Err(_) => config
.openai_api_key
.unwrap_or(""),
};Alternatively there could be a chatgpt.local boolean option, which, if true, makes the API key optional. But I think the empty string way is better, and if someone leaves it empty for online models, we already get a 401 Unauthorized message.
If you're okay with this, I can make a PR.
Metadata
Metadata
Assignees
Labels
No labels