Inconsistent markdown response from OpenAI service

John Ferguson 0 Reputation points
2023-07-04T14:08:18.8833333+00:00

The OpenAI service (model: gpt35turbo, API version: 2023-06-01-preview) is extremely inconsistent with regards to the completeness and accuracy of the markdown syntax it returns via the chat completions endpoint.

A "good" example, from the prompt "Show me an example of C++ code that implements a simple function to calculate the factorial of a given number." is:

User's image

Note the code-block is correctly opened and closed with three backticks and labelled with the correct language tag is included. The whole response is a single string, escaped once.

However, perhaps one in ever 3-5 requests will return a response like this:

User's image

Note the entire response is one long double-escaped string. As this is displayed in a markdown component, the code-block is not rendered properly, and the \n and \t markers are visible.

Other markdown inaccuracies include lists. For example:

User's image

Note that number 9 (Congo) does not have a period (.) after the number. This means this is not rendered as part of the number sequence by the markdown renderer and therefore ends up looking like this:

User's image


  • Am I missing something?
  • Is there a setting or something that I can alter to fix this?
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
4,080 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.