Sending \n in prompt causes the completions API to fail

I had to remove all the \n from my hardcoded initial prompt (when I first make the connection to the completions API). This lets the API respond successfully but without \n’s it hard to format what we want the response to look like.

The same prompt with a \n causes this error
“The Operation couldn’t be completed”

Can you share some code in markdown format so it’s easy to read? Are you actually entering a line-break or typing \n?

What Stop sequence are you using?

I don’t know what your prompt is, but I learned from humphree that \n needs to be surrounded by spaces for a translation to work.

Hi @chadha.manu

Please share code and prompt that resulted in this error.

Mostly it’s recommended that ‘\n’ or ’ ’ shouldn’t be at the end of prompt.

1 Like