Skip to content

Commit

Permalink
adjust prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
cyyeh committed Dec 2, 2024
1 parent b95924f commit 8e044e2
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions wren-ai-service/src/pipelines/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ async def _task(result: Dict[str, str]):
"""


chart_generation_instructions = """
### INSTRUCTIONS ###
Expand All @@ -457,7 +456,19 @@ async def _task(result: Dict[str, str]):
- In order to generate the grouped bar chart, you need to follow the given instructions:
- Disable Stacking: Add "stack": null to the y-encoding.
- Use xOffset: Introduce xOffset for subcategories to group bars.
- In order to generate the pie chart, you need to follow the given instructions:
- Add {"type": "arc"} to the mark section.
- Add "theta" encoding to the encoding section.
- Add "color" encoding to the encoding section.
- Don't add "innerRadius" to the mark section.
- If the x-axis of the chart is a temporal field, the time unit should be the same as the question user asked.
- For yearly question, the time unit should be "year", ex. YYYY.
- For monthly question, the time unit should be "year + month", ex. YYYY-MM.
- For weekly question, the time unit should be "year + month + day", ex. YYYY-MM-DD.
- For daily question, the time unit should be "year + month + day", ex. YYYY-MM-DD.
- Always add tooltip to the chart using the "tooltip" property in the mark section.
- The tooltip should be {"content": "data"}
### GUIDELINES TO PLOT CHART ###
1. Understanding Your Data Types
Expand Down Expand Up @@ -526,7 +537,7 @@ async def _task(result: Dict[str, str]):
{"Region": "West", "Sales": 400}
]
},
"mark": "bar",
"mark": {"type": "bar", "tooltip": {"content": "data"}},
"encoding": {
"x": {"field": "Region", "type": "nominal"},
"y": {"field": "Sales", "type": "quantitative"}
Expand All @@ -545,7 +556,7 @@ async def _task(result: Dict[str, str]):
{"Date": "2022-01-04", "Sales": 400}
]
},
"mark": "line",
"mark": {"type": "line", "tooltip": {"content": "data"}},
"encoding": {
"x": {"field": "Date", "type": "temporal"},
"y": {"field": "Sales", "type": "quantitative"}
Expand All @@ -564,7 +575,7 @@ async def _task(result: Dict[str, str]):
{"Company": "Company D", "Market Share": 0.1}
]
},
"mark": {"type": "arc"},
"mark": {"type": "arc", "tooltip": {"content": "data"}},
"encoding": {
"theta": {"field": "Market Share", "type": "quantitative"},
"color": {"field": "Company", "type": "nominal"}
Expand Down

0 comments on commit 8e044e2

Please sign in to comment.