Handbook
Glossary
init-api-key ( -- )
Vocabulary
openai
.
ui
Word description
Initialize the API key which MUST be located in the path set in
OPENAI-KEY-PATH
Definition
USING:
io
io.encodings.utf8
io.files
kernel
namespaces
openai
sequences
;
IN:
openai.ui
:
init-api-key
( -- )
openai-api-key
get-global
[
OPENAI-KEY-PATH
get-global
dup
file-exists?
[
utf8
file-lines
first
openai-api-key
set-global
]
[
drop
"Missing API key in OPENAI-KEY-PATH"
print
]
if
]
unless
;