Unwanted # symbols added in front of all titles and sub titles

No matter how hard i try to debug the python code with chatgpt. The openai api calls repeatedly return text with annoying ### symbols in front of all the titles and sub titles. i even tried telling the system prompt to stop doing that but no joy. what is causing this in python script api calls?

1 Like

What you’re encountering is the model using Markdown formatting to make the output more readable. Perhaps try instructing it to provide its response as text only with no additional formatting, including markdown.

4 Likes

@phily8020 - Welcome to the community,

There are two steps you could take.

  1. Post-process to remove ### symbols and pass it back as chat_history if you need it as context.

  2. Try not to use negatives while constructing the prompt, like “DO NOT” or “NEVER”. Try to use Dos instead and you could use an authoritatve tone using “STRICTLY”.

Cheers!

3 Likes

Welcome to the Community!

Agree with @trenton.dambrowitz: adding an instruction along the lines of “Return the response in plain text without any formatting” should do the trick.

2 Likes