I used Python to access the OpenAI API, then used discord.py to integrate it into a Discord bot. My command looks like this:
@bot.command()
async def chat(ctx, *, input: str):
openai.api_key = os.getenv(envName)
async with ctx.channel.typing():
response = openai.Completion.create(
engine="text-davinci-003", # latest model (the one used for GPT-3)
prompt=input,
temperature=random.randrange(50, 90) / 100,
max_tokens=1000,
top_p=1,
frequency_penalty=0,
presence_penalty=0,
timeout=10
)
output = response.choices[0].text
await ctx.reply(output)
The command works properly as intended. I give it an input, and it gives me a proper output.
However, I recently discovered that for a simple input such as "hi", it gives me some gibberish output. Moreover, this output is completely different for each time.
Please refer to the images below for its output.
Note that this command works completely fine for any other queries: for example,
Strangely, it gives a normal response for "hello" also.
What could be the reason why it responds improperly for a simple "hi" query?