Spaces:
Running
Running
Update hackaprompt/completers.py
Browse files
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 =
|
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
|
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...")
|
|
|
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...")
|