Skip to content

Commit

Permalink
fix: fixed error when no OPENAI_API_KEY set
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Oct 10, 2023
1 parent edb1982 commit 9b8f4e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gptme/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def init_llm(llm: str):
if llm == "openai":
if "OPENAI_API_KEY" in os.environ:
api_key = os.environ["OPENAI_API_KEY"]
elif api_key := config["env"]["OPENAI_API_KEY"]:
elif api_key := config["env"].get("OPENAI_API_KEY", None):
pass
else:
print("Error: OPENAI_API_KEY not set in env or config, see README.")
Expand Down

0 comments on commit 9b8f4e1

Please sign in to comment.