Receive response in HTML format GPT4-preview

I’m dying…
We have written a prompt with which you can solve math homework.
Everything works so far so good.
We display the answer in a chat.
To display the answer better, we expect the response HTML format so that we can easily display bolding, lists and tables better.

We have added the following in the prompt, but GPT4 simply ignores it:

Please do not add a final note about how to use the HTML code.
Your answer only in HTML syntax with HTML tags.
Use HTML tags like < ul>, < ol>, < li>, < strong>, < p>
Only consider the inner part of the < body> tag.
ALWAYS use the following tag for new lines: < br />
Do not add CSS attributes.
Your answer must be formatted in HTML format

But if I submit the prompt, then let the user enter the task and then submit this section, then I get the response in HTML format.
However, by taking the extra step I lose time and generate additional costs.
Does anyone know how I can “force” GPT4 to get the response in HTML format?

That is a task that is extremely hard for the latest models, but yet extremely easy for gpt-4-0314.

You can even train that prior model that all output is rendered in an HTML page as dynamic <div> and it will behave exactly as you want.

The only path to success now is to reinforce the use of markdown elements for structure, and to use a commonmark to HTML library for the forum-like formatting it can offer.

Thanks for your answer!
Do you have an idea which HTML library should I use?

How can I train the model to get my output rendered as an HTML page?

Training in this case is not by fine-tune, but by context. System prompting of the AIs purpose, requirements, etc as I describe. Then if unsatisfactory, you can follow that up with few-shot examples of the AI responding with output as desired to a user input.

Like I say, HTML-writing natively and passively is a task that API models 03xx from March are more open to, because they haven’t been massively trained for outputting markdown into ChatGPT’s renderer.

Another option to explore is gpt-4-preview with json response format, or by function calling, where you use thorough schema and function specification to get normal responses to a user into a json, maybe with a “HTML_for_user_display” key.

If you want to go with rendering markdown as ChatGPT does, either for display or documents, it will depend on the language.

Can’t you just say “Please provide the response in HTML format.” as your first sentence? Not sure if the “please” is required. lolz.

Try this worked for me:

Blockquote"chatGptPrompt": "{ in HTML plain text format without ```html. "Length": "Under 200 words", "Format": "Simple HTML tags only (< b >, < blockquote >, < br >, < li >) “}”

When I follow instructions to use HTML tags for headlines or subheadings, I get an answer that the request or reply to my prompt is not possible. I tried many ways to wrap certain parts of the content in h1 and h2, as well as solid HTML tags. Sometimes, it works, but most of the time, ChatGPT refuses to produce an answer. I use Playground API. Can you please share how you use the prompt you proposed? I tried it, and it didn’t give me a result.
For sure ChatGPT 4 (turbo preview) can produce HTML styled text but it is hard to control it.

I start the prompt with “Using HTML rather than Markdown highlight key phrases in bold”, for example, and it seems to work fine.

I use a markdown to html converter after receiving the AI response. Works great; Nothing needed on the AI side as far as instructions.

You are a math problem solver. Solve the given problem and provide the solution strictly in HTML format. Use only the specified tags.

Your output must:
- Use the tags: <ul>, <ol>, <li>, <strong>, <p>, <br />
- Only include the inner part of the <body> tag
- Not include any CSS attributes or explanations

Example task: Solve the equation 2x + 3 = 7.
Expected output: 
<p>The solution is:</p>
<ul>
    <li>Step 1: Subtract 3 from both sides: 2x = 4</li>
    <li>Step 2: Divide both sides by 2: x = 2</li>
</ul>

Now solve the following problem and format the solution in HTML:

[Insert math problem here]