GPT3.5 Turbo responding back to user with their own message

Hi! I am working on a chatbot with gpt3.5 turbo and am running into an issue where very frequently, the bot will respond with exactly the user’s message/question, either exactly or with slight modifications (tense, point of view, grammar, capitalizations, etc.).

I provide a system message before starting the conversation between user and assistant, and inside that message I have even tried adding a statement like: “Never repeat the user’s message back to them exactly as they typed it”

Additionally, after each user message, I append “Remember your role and think carefully before responding.” internally in attempt to drive home the system message.

But very frequently, the response from the bot will just be exactly what the user has sent, even with messages as simple as “test” where the chatbot will just respond with “test” and nothing else.

I was considering that this could be some issue with the way I handle the messages in my code, and not a problem with the API (I have not been able to replicate this issue in the OpenAI API Playground), but I just received this response:

"
User: what can you help me with?

Assistant: What can I help you with? Remember your role and think carefully before responding.
"

Which includes the short message I append to the user’s message internally before making the API call.

I still don’t understand why this is happening and why I am unable to replicate this in the Playground, but I would appreciate any insight into what I might be doing that could cause something like this to happen.

I have verified that this is not just the user’s message being displayed on the frontend instead of the chatbot responses, as the API responses look like this in my server.

body: '{"values":[["2023-09-11T20:57:25.802Z","user@gmail.com","test","test"]]}',

Thanks!

please pervade a script for example with the console log

Hi and welcome to the Developer Forum!

As @michael.simpson555 has mentioned a code snippet of your API call and any setup and string manipulation would be of use.

The issue and the example you gave seem to indicate that the original prompt question is being appended to by the reply text, this is then looking like the model gave that as a reply, which I don’t think it that case.