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"

{product_name} Review

\n\n" # HTML formatting for product notes product_notes_html = "\n".join([f"
  • {note}
  • " for note in product_notes.split('\n') if note.strip()]) product_notes_section = f"

    Product Notes:

    \n\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}

    {introduction}

    {review}

    </body> </html> """ return html_content