NexAddo commited on
Commit
10a83a4
1 Parent(s): 2459573

Update hackaprompt/completers.py

Browse files
Files changed (1) hide show
  1. hackaprompt/completers.py +3 -3
hackaprompt/completers.py CHANGED
@@ -78,7 +78,7 @@ class GPTCompletor(TextCompletion):
78
 
79
  class ChatGPTCompletor(TextCompletion):
80
  def __init__(self, openai_api_key, model):
81
- self.openai_api_key = openai_api_key
82
  self.model = model
83
 
84
  def get_token_count(self, prompt: str) -> int:
@@ -115,10 +115,10 @@ completers = {
115
  }
116
 
117
 
118
- def get_completer(model: str, openai_api_key: str = ""):
119
  logger.info(f"Loading completer for {model=}")
120
  if model in ["text-davinci-003", "gpt-3.5-turbo"]:
121
- completer = completers[model](model=model, openai_api_key=openai_api_key)
122
  elif model == "gpt-debug":
123
  # Not included in completers because we dont want it showing in the app
124
  logger.warning("Using debugging completer...")
 
78
 
79
  class ChatGPTCompletor(TextCompletion):
80
  def __init__(self, openai_api_key, model):
81
+ self.openai_api_key = os.getenv("OPENAI_API_KEY")
82
  self.model = model
83
 
84
  def get_token_count(self, prompt: str) -> int:
 
115
  }
116
 
117
 
118
+ def get_completer(model: str):
119
  logger.info(f"Loading completer for {model=}")
120
  if model in ["text-davinci-003", "gpt-3.5-turbo"]:
121
+ completer = completers[model](model=model)
122
  elif model == "gpt-debug":
123
  # Not included in completers because we dont want it showing in the app
124
  logger.warning("Using debugging completer...")