ChatGpt-3 Provides different output that are not related to queries

Hi all,
I’ve been encountering some issues with chatgpt-3’s output responses. They don’t seem to align with my queries. I’ve tried increasing the max token from 30 to 256 and adjusting the temperature range from 1-7. After some experimentation, I found that setting the temperature to 1 provides kind of a better responses but unfortunately, these changes haven’t resolved the issue. The output responses can be quite strange, sometimes covering unrelated topics like Japanese cars, museums, Ohio clinics, and Amazon AWS.

Here’s a snippet of my code

1 Like

Hi welcome to the community,
Temperature is a parameter that controls the “creativity” or randomness of the text generated by GPT-3. A higher temperature (e.g., 0.7) results in more diverse and creative output, while a lower temperature (e.g., 0.2) makes the output more deterministic and focused. I think you have lower down your temperature( 0.5 or as per your needs) to get more focused results. and you have to set the temperature to under (0-1) ‘0’ means 100% focused & ‘1’ means creative response.

3 Likes

You are using davinci, an old model, directly in an old URL style. Don’t let AI write your code.

Updated:

curl https://api.openai.com/v1/completions
-H “Content-Type: application/json”
-H “Authorization: Bearer $OPENAI_API_KEY”
-d ‘{
“model”: “gpt-3.5-turbo-instruct”,
“prompt”: “You are an AI brainstorming assistant. Generate short relevant names for: a new magnetic airplane engine”,
“temperature”: 0.6,
“max_tokens”: 256,
“top_p”: 0.5,
}’

results:>

  1. MagJet
  2. AeroMagnet
  3. FluxFlyer
  4. MagnaProp
  5. AeroMag
  6. MagnetAir
  7. AeroForce
  8. MagPlane
  9. FluxEngine
  10. AeroMotive
1 Like

I appreciate it. I was using the old davicin. Thank you

1 Like

Thank you for your help. I truly appreciate it, I’ll give it a try

If I may ask you this. So let’s say I’m trying to call the ChatGpt-3 API for a rephrasing or rewriting job, do I use the same curl https://api.openai.com/v1/completions as the endpoint?
I’m so new to ChatGpt API and have read the documentation but still need clarifications as a handbook.
Thanks in advance.

you can use the v1 chat completions endpoint for rephrasing or rewriting jobs with GPT-3 turbo.

I’ve tried several and can’t seem to find out why I’m getting the API request error: Error: API request failed with status 400 Here’s a snippet of the code.
CLT

The 400 represent bad requset check your API Key is it correct and the active one. there no error in the endpoint. try running with the below code.

if (inputText.trim() !== '') {
    const prompt = `You are an AI assistant: Rephrase this sentence or Rewrite this sentence: ${inputText}`;
    sendRequestToAPI(prompt, (response) => {
        inputOutputTextArea.value = response;
    });
} else {
    alert('Please enter text to rewrite.');
}

function sendRequestToAPI(prompt, callback) {
    const apiKey = 'My API KEy'; // Add the Active Key here
    const apiUrl = 'https://api.openai.com/v1/chat/completions';
    fetch(apiUrl, {
        method: 'POST',
        headers: {
            'Authorization': `Bearer ${apiKey}`,
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({ prompt }),
    })
    .then((response) => {
        if (!response.ok) {
            throw new Error(`API request failed with status ${response.status}`);
        }
        return response.json();
    })
    .then(data => {
        callback(data);
    })
    .catch(error => {
        console.error("Error:", error);
    });
}

Is it possible to use GPT-4 as model instead of “model: gpt-3.5-turbo-instruct”?

We can see in the most recent screenshot, only the text of a user input is being sent as the body of an API request to the endpoint.

As one can read by clicking “API Reference”, a complete object must be sent to the chat endpoint. An example:

{
    "model": "gpt-3.5-turbo",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "Hello!"
      }
    ]
  }
1 Like

Thank you for your help appreciated the time and knowledge

That’s right, I wanted to use this method, but my focus was "API, API API "
thank you so much!