Skip to content

Commit

Permalink
Add check on openai key
Browse files Browse the repository at this point in the history
  • Loading branch information
danieltrt committed Jul 5, 2023
1 parent d90cdc9 commit c4b552f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion experimental/rule_inference/local.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import multiprocessing
import os
import sys
import time

import attr
Expand All @@ -11,7 +12,9 @@
from utils.pretty_toml import PrettyTOML

from experimental.rule_inference.piranha_agent import (
PiranhaAgent, run_piranha_with_timeout)
PiranhaAgent,
run_piranha_with_timeout,
)
from experimental.rule_inference.rule_application import CodebaseRefactorer
from experimental.rule_inference.utils.rule_utils import RawRuleGraph

Expand Down Expand Up @@ -165,4 +168,8 @@ def test_rule(data):

if __name__ == "__main__":
openai.api_key = os.getenv("OPENAI_API_KEY")
if not openai.api_key:
sys.exit(
"Please set the OPENAI_API_KEY environment variable to your OpenAI API key."
)
app.run(debug=True)

0 comments on commit c4b552f

Please sign in to comment.