#attempting to use the OpenAI API but always get an empty response

10 messages · Page 1 of 1 (latest)

obsidian tide
#

I'm attempting to use the OpenAI API but always get an empty response.
Here is the input object=>
model: "text-davinci-003", temperature: 0, max_tokens: 100, top_p: 1, frequency_penalty: 0…}

model: "text-davinci-003"
temperature: 0

max_tokens: 100
top_p: 1
frequency_penalty: 0
presence_penalty: 0
stop: Array(1)
prompt: "what is the life expectancy in china"

and the response object is =>
{data: Object, status: 200, statusText: "", headers: Object, config: Object…}

data: Object
id: "cmpl-6nUMCcYu784i2bLXF0iHOEqmsYU6q"
object: "text_completion"
created: 1677252784
model: "text-davinci-003"
choices: Array(1)
0: Object
text: ""
index: 0
logprobs: null
finish_reason: "stop"
usage: Object
status: 200
statusText: ""
headers: Object
config: Object
request: XMLHttpRequest

as you can see the reponse.data.choices[0].text is empty

obsidian tide
#

you mean to remove this higlighted array from my code?

#

actually i have reffered this from openai's website

#

actually yess it worked

fallow fog
#

you may not know stop sequences well

#

that’s a flag to let the model stop generating further text

obsidian tide
#

thankyou steve for helping me.

#

really appreciate you man