Skip to content

Commit

Permalink
update openai
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Pro committed Dec 28, 2023
1 parent 71eb8d7 commit 8e61b89
Show file tree
Hide file tree
Showing 3 changed files with 191 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Pillow = "==10.0.1"
toml = "==0.10.2"
install = "==1.3.5"
aiohttp = "==3.8.5"
openai = "==0.28.0"
openai = "==1.6.1"
typing-extensions = "==4.8.0"
google-generativeai = "==0.3.2"

Expand Down
191 changes: 187 additions & 4 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions bot/skills/buktopuha.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,16 +330,16 @@ def check_for_answer(update: Update, context: CallbackContext):
def generate_question(prompt, word) -> str:
model = random.choice(["gpt-3.5-turbo", "gpt-4-1106-preview", "gemini-pro"])
if model.startswith("gpt"):
response = openai.ChatCompletion.create(
response = openai.chat.completions.create(
model=model,
prompt=prompt,
messages=[{"role": "system", "content": prompt}],
temperature=0.9,
max_tokens=150,
top_p=1,
frequency_penalty=0,
presence_penalty=0.6,
)
rs = response["choices"][0]["text"]
rs = response.choices[0].message.content
return f"{model}: " + re.sub(
word, "***", rs, flags=re.IGNORECASE
).strip().strip('"')
Expand Down

0 comments on commit 8e61b89

Please sign in to comment.