#text-davinci-003 or something is not allowing me to get text (response.text)

4 messages · Page 1 of 1 (latest)

analog plinth
#

Hey! I need some help. I am having trouble with my code. It worked earlier today. Tbh idk what happened but now it won't work. ChatGPT wont help. I tried you support page but the chat bot just ended the conversation. The code does bot know what the text part of response.text is. Here is my code:

response = openai.Completion.create(
  model="text-davinci-003",
  prompt=f"Summarize this for a Discord user:\n{text}",
  temperature=0.7,
  max_tokens=256,
  top_p=1,
  best_of=4,
  frequency_penalty=0.8,
  presence_penalty=0
)

await ctx.respond(response.text)
#                           ^^^ this is where I keep having issues (response.text)```
Here is the error:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/bot.py", line 992, in invoke_application_command
await ctx.command.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/commands/core.py", line 358, in invoke
await injected(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/commands/core.py", line 135, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: text```
I am new to #1037561751362863144 but I trust there are a bunch of smart people to help me! yes

sick veldt
#

Hey there’s no .text attribute on the response returned by .create

#

it’s a dictionary that’s returned

#

You can access the result of the completion by accessing response["choices"][0]["text"]