Problem in generating HTML content using GPT4

31 Views Asked by At

I am trying to generate some html content as output from GPT-4. Below is my prompt:

Write a blog post about {{blog_title}}. Give your output in the following JSON format, do not produce anything else:
{
    "html_content": String
}

However, when I try to load the response using json.loads function in python it fails as \n character in the html is not escaped.

I changed my prompt to the following:

Write a blog post about {{blog_title}}. ALWAYS use \\n instead of \n for newline in HTML so that I can parse it i.e. NEVER use just \n for newline.
Give your output in the following JSON format, do not produce anything else:
{
    "html_content": String
}

But I see it sometimes failing to stick to the prompt, is there any other way to solve this issue.

0

There are 0 best solutions below