Skip to content

Commit

Permalink
Merge pull request #297 from C-Pro/feature/upd-gpt-model
Browse files Browse the repository at this point in the history
shorter questions, strip quotes
  • Loading branch information
C-Pro authored Sep 24, 2023
2 parents 7d88037 + acd2ab9 commit fe04315
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bot/skills/buktopuha.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,11 @@ def start_buktopuha(update: Update, context: CallbackContext):
word = random.choice(WORDLIST)
prompt = f"""You are a facilitator of an online quiz game.
Your task is to make engaging and tricky quiz questions.
You should try to make your question fun and interesting, but keep your wording simple.
You should try to make your question fun and interesting, but keep your wording simple and short (less than 15 words).
Keep in mind that for part of the audience English is not a native language.
You can use historical references or examples to explain the word.
For expample good quiz question for word "horse" can be:
During the Trojan War Greeks used a wooden statue of this animal to trick Troy defenders into letting Greek soliders into the city.
Wooden statue of this animal helped to end the siege of Troy.
Please write a quiz question for the word '{word}' using single sentence without mentioning the word itself."""
try:
Expand All @@ -367,7 +367,7 @@ def start_buktopuha(update: Update, context: CallbackContext):
presence_penalty=0.6,
)
rs = response["choices"][0]["text"]
question = re.sub(word, "***", rs, flags=re.IGNORECASE).strip()
question = re.sub(word, "***", rs, flags=re.IGNORECASE).strip().strip('"')
except: # pylint: disable=bare-except # noqa: E722
logger.error("Error calling OpenAI API", exc_info=1)
result = context.bot.send_message(
Expand Down

0 comments on commit fe04315

Please sign in to comment.