import openai
def generate_product_review(product_name, product_notes):
openai.api_key = 'YOUR_OPENAI_API_KEY'
introduction = f"Introducing the {product_name} – A Game Changer in the Tech World!\n\n"
heading = f"<h1>{product_name} Review</h1>\n\n"
# HTML formatting for product notes
product_notes_html = "\n".join([f"<li>{note}</li>" for note in product_notes.split('\n') if note.strip()])
product_notes_section = f"<h2>Product Notes:</h2>\n<ul>\n{product_notes_html}\n</ul>\n\n"
prompt = f"Generate a captivating review for the {product_name}:\n\nReview:"
prompt = introduction + heading + product_notes_section + prompt
response = openai.Completion.create(
engine="text-davinci-003", # We can use other engines like gpt-3.5-turbo or gpt-4
prompt=prompt,
max_tokens=800 # Adjust the length as needed
)
review = response.choices[0].text.strip()
# HTML formatting
html_content = f"""
<html>
<head>
<title>{product_name} Review</title>
</head>
<body>
{heading}
<p>{introduction}</p>
<p>{review}</p>
</body>
</html>
"""
return html_content
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}