#Response is blank
1 messages · Page 1 of 1 (latest)
Hi @warm plinth. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
There could be several reasons why you're getting a blank or undefined response from the OpenAI API. Here are a few things you could check:
-
Check your prompt: Make sure the prompt you're passing to the API is correctly formatted and contains valid content. The prompt is the input that you give to the model to generate a response.
-
Check your API call: Ensure that you're making the API call correctly. Here's an example of how to make an API call using the OpenAI Node.js SDK:
const response = await openai.createChatCompletion({
model: "gpt-4-32k-0314",
messages: [
{
role: "system",
content: system,
},
{
role: "user",
content: `${user}`,
},
],
temperature: 0.3,
frequency_penalty: 0.7,
presence_penalty: 0.7,
stream: true,
max_tokens: 3500,
});
(Source: Forum Post: Api call to gpt-4-32k or gpt-4 allucinate at the end of long responses > Original post Part 1 (https://community.openai.com/t/646316))
-
Check your model: Make sure you're using a valid model. The model name should be passed as a string to the
modelparameter in the API call. For example, "gpt-4-32k-0314". -
Check your API key: Ensure that your OpenAI API key is correctly set in your environment variables and that it has the necessary permissions.
-
Check the API response: The response from the API call should be an object that contains the generated text. You can access this text using
response.choices[0].message.contentfor chat models.