Chat completion text format


Using chat/completions endpoint, I can see the resulting text contains some formatting sequences like

\[ \text{Area} = \pi r^2 \]

I could not find in the doc what standard this is, can someone help?


Looks like latex output from sympy python module?

That is the AI model producing Latex math for ChatGPT. The new models are basically ChatGPT at minimum expense with API users as an afterthought.

The backslash escaping of square brackets is specific to ChatGPT’s renderer and is a relatively new switch. This forum uses more standard dollar-sign container, for example

\text{Area} = \pi r^2

You can write a mathjax handler to go along with a markdown renderer. Or you can tell the AI not to output in TeX or Latex.