Skip to content

Commit a93db65

Browse files
authored
Update client.go with a meaningful message to set openAPI key
Update client.go with a meaningful message to set openAPI key Signed-off-by: Saiyam Pathak <saiyam911@gmail.com>
1 parent 357da7b commit a93db65

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/openai/client.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ func complete(opts ...Options) (result Options, err error) {
7171
if result.APIKey == "" && key != "" {
7272
result.APIKey = key
7373
}
74-
74+
75+
if result.APIKey == "" {
76+
return result, fmt.Errorf("OPENAI_API_KEY is not set. Please set the OPENAI_API_KEY environment variable")
77+
}
78+
7579
return result, err
7680
}
7781

0 commit comments

Comments
 (0)