Untitled

 avatar
unknown
plain_text
a month ago
1.9 kB
4
Indexable
# Example variables you might have from your code:
template = [...]  # Your template array
sections = ','.join([i['sectionTitle'] for i in template])

# Convert your template array to a string. If it's a Python list/dict, you might:
import json
template_data_str = json.dumps(template, indent=4)  # Nicely formatted JSON string

prompt = f"""
You are an expert in performing analytics on the provided data and generating HTML and JavaScript code for interactive data visualizations. 
Your task is to create a single self-contained HTML file that displays all sections from the provided template array. 
Each section must be displayed in a separate <div> container.

**Instructions:**
1. Use the following template array (pasted below) to render **all** sections and **all** widgets.
2. For each `section_data` field in the template and each item in its array, generate an appropriate Plotly chart or table according to the `widget_description`.
3. Place each section’s content (the charts or tables) inside a <div> with a heading or sub-heading for that section.
4. The HTML must be self-contained, including all resources (CSS/JS). If you use a CDN for Plotly, embed its script link directly so the HTML works on its own.
5. Include a brief explanatory note within the HTML (e.g., a <p> or <div>) for each chart/table—this is the “detailed explanation about the graph or visualization.”
6. Return only the complete HTML code, with no additional text outside the HTML.

**Here is the 'template' array to be used:**

{template_data_str}

Below is a list of all sections to be rendered (from the template array):
{sections}

Please generate the final HTML code now, following all the above requirements, without any extra text outside the HTML code.
"""

# Now you would pass `prompt` to your LLM for generating the answer, for example:
# response = llm.generate(prompt)
# print(response)
Leave a Comment