GPT-4.1 API: Issues with HTML Formatting and Ignoring Prompt Instructions

Subject: GPT-4.1 API: Issues with HTML Formatting and Ignoring Prompt Instructions

Hi everyone,

I’m reaching out to share some challenges I’ve been facing with the GPT-4.1 API, hoping to find insights or solutions from the community.

HTML Formatting Issues:

I’ve noticed that GPT-4.1 often returns HTML content with improperly formatted tags. For instance:

Tags like

  • are returned as <li>, which causes rendering issues.

    Closing tags sometimes appear with irregular spacing, such as </ li >, leading to invalid HTML.

    These formatting inconsistencies are problematic, especially when integrating the output into web applications or content management systems.

    Ignoring Prompt Instructions:

    Despite providing clear and specific prompts, GPT-4.1 occasionally disregards the instructions. Examples include:

    Failing to adhere to specified output formats.

    Overlooking explicit directives, such as “Do not include markdown formatting.”

    This behavior is unexpected, especially considering GPT-4.1’s touted improvements in instruction adherence.

    Steps Taken:

    I’ve experimented with adjusting the temperature, frequency_penalty, and presence_penalty parameters, but these changes haven’t resolved the issues.

    Implemented post-processing scripts to correct HTML formatting, but this feels like a workaround rather than a solution.

    Until yesterday, everything was functioning normally. However, today I’ve been experiencing continuous issues with the ChatGPT API.

    Here’s an example of the HTML output I’m receiving:

    <li>They ignore the quality and structure of the soil: overly loose or clumpy areas will never yield upright flower stalks;&lt;/ li &gt;</li>
    <li>They plant too shallowly or scatter bulbs on the surface—resulting in widespread drooping by late June;&lt;/ li &gt;</li>
    <li>They apply too much fresh manure or nitrogen—leading to lush foliage and weak, “watery” stems;&lt;/ li &gt;</li>
    <li>They don't mulch the planting after the first sprouts—the soil dries out and compacts at the base;&lt;/ li &gt;</li>
    <li>They forget to regularly loosen the rows during summer—oxygen is lacking for the development of a strong root system;&lt;/ li &gt;</li>
    <li>They support individual specimens with sharp stakes or wire directly at the base—bulbs get injured, leading to fungal infections;&lt;/ li &gt;</li>
    <li>They massively cut the leaves long before flowering ends—the plant weakens physically!&lt;/ li &gt;</li>
    

    It also sometimes writes articles in multiple languages, even when only one language is specified!

    Has anyone else encountered similar issues with GPT-4.1?