Skip to content

Commit

Permalink
fix: improve handling of missing API key errors
Browse files Browse the repository at this point in the history
- Change error message when api key is missing

Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed Apr 4, 2023
1 parent b492f7d commit 996b5fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion openai/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func New(opts ...Option) (*Client, error) {

instance := &Client{}
if cfg.token == "" {
return nil, errors.New("missing api key")
return nil, errors.New("please set OPENAI_API_KEY environment variable")
}

v, ok := modelMaps[cfg.model]
Expand Down

0 comments on commit 996b5fe

Please sign in to comment.