hi i am trying to make a chatbot with python but this api keeps generating random responses totally not related to the prompt for example i say hello and it responds with
, world")
# Output
# "Hello, World!"
attaching a screenshot too for reference
here’s the code:
@commands.Cog.listener()
async def on_message(self, message):
if message.author == self.bot.user:
return
else:
if message.channel.id == 1055813186273689600:
await message.channel.trigger_typing()
openai.api_key = openaikey
response = openai.Completion.create(
model=“text-davinci-003”,
prompt=message.content,
temperature=0.9,
max_tokens=2048,
frequency_penalty=0.0,
presence_penalty=0.0
)
await message.channel.send(response[‘choices’][0][‘text’])