GPT-3 API Producing Repetitive Responses in Chatbot Application

Hello everyone,

I’ve been working on integrating the OpenAI GPT-3 API into a chatbot application, and I’ve come across an issue that’s left me stumped. I’m hoping someone here might have encountered something similar or could offer some insights.

Issue Description:

When sending various queries to the GPT-3 model, the responses I receive are unexpectedly repetitive. Here are a couple of examples:

  • Prompt: “How are you?” Response: “I am fine. I am fine. I am fine…” (and it continues like this)
  • Prompt: “What is the color of grass?” Response: “The color of grass is green. The color of grass is green…” (again, repetitive)

Attempts to Resolve:

  • I’ve tried adjusting the model parameters, such as temperature and max_tokens, to see if they influence the outcome, but the repetitive behavior remains consistent.
  • As an experiment, I introduced a system message to the prompts (e.g., “You are a helpful assistant.”) with the hope of guiding the model’s behavior. Unfortunately, this didn’t yield the desired improvement.
  • I also tested the model using a direct API call in a standalone Python script and observed the same repetitive outputs.


  • I’m using Flask for the server-side operations and JavaScript for the frontend.
  • The API interactions are done using Python’s openai library.

Has anyone here encountered such behavior with GPT-3 or any other models? If so, do you have any recommendations or workarounds to achieve more coherent and varied responses?

Thanks in advance for any assistance or advice you can offer!

Best regards, Noah
PS: I have little experience in coding so I´ve mostly just been following what GPT-4 told me to do :slight_smile:

Hi and welcome to the developer forum!

Can you pleas post your code, it’s hard to try and work out what might be happening without it, also include an example input prompt and output, i.e., include a typical API call session start to finish as a log file along with the code that produced it.

Hey! Thank you so much for helping out!

I was actually able to fix the issue myself in the meantime, which is really surprising given my close to 0 knowledge in coding haha.
But thank you regardless for the offered assistance! :))