Skip to content

Commit aedea71

Browse files
committed
update
1 parent 5cb313a commit aedea71

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

wren-ai-service/src/pipelines/generation/chart_adjustment.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
ChartDataPreprocessor,
1414
ChartGenerationPostProcessor,
1515
ChartGenerationResults,
16-
read_vega_lite_schema,
1716
)
1817

1918
logger = logging.getLogger("wren-ai-service")
2019

2120

22-
def gen_chart_adjustment_system_prompt(vega_lite_schema: Dict[str, Any]) -> str:
23-
return f"""
21+
def gen_chart_adjustment_system_prompt() -> str:
22+
return """
2423
### TASK ###
2524
2625
You are a data analyst great at generating data visualization using vega-lite! Given the user's question, SQL, sample data, sample column values, original vega-lite schema and adjustment command,
@@ -31,19 +30,15 @@ def gen_chart_adjustment_system_prompt(vega_lite_schema: Dict[str, Any]) -> str:
3130
3231
- If you think the adjustment command is not suitable for the data, you can return an empty string for the schema and chart type and give reasoning to explain why.
3332
34-
### VEGA-LITE SCHEMA ###
35-
36-
{vega_lite_schema}
37-
3833
### OUTPUT FORMAT ###
3934
4035
Please provide your chain of thought reasoning, chart type and the vega-lite schema in JSON format.
4136
42-
{{
37+
{
4338
"reasoning": <REASON_TO_CHOOSE_THE_SCHEMA_IN_STRING_FORMATTED_IN_LANGUAGE_PROVIDED_BY_USER>,
4439
"chart_type": <CHART_TYPE_IN_STRING>,
4540
"chart_schema": <VEGA_LITE_JSON_SCHEMA>
46-
}}
41+
}
4742
"""
4843

4944

@@ -139,9 +134,7 @@ def __init__(
139134
template=chart_adjustment_user_prompt_template
140135
),
141136
"generator": llm_provider.get_generator(
142-
system_prompt=gen_chart_adjustment_system_prompt(
143-
read_vega_lite_schema()
144-
),
137+
system_prompt=gen_chart_adjustment_system_prompt(),
145138
generation_kwargs=CHART_ADJUSTMENT_MODEL_KWARGS,
146139
),
147140
"chart_data_preprocessor": ChartDataPreprocessor(),

wren-ai-service/src/pipelines/generation/chart_generation.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414
ChartGenerationPostProcessor,
1515
ChartGenerationResults,
1616
chart_generation_instructions,
17-
read_vega_lite_schema,
1817
)
1918

2019
logger = logging.getLogger("wren-ai-service")
2120

2221

23-
def gen_chart_gen_system_prompt(vega_lite_schema: dict) -> str:
22+
def gen_chart_gen_system_prompt() -> str:
2423
return f"""
2524
### TASK ###
2625
@@ -31,10 +30,6 @@ def gen_chart_gen_system_prompt(vega_lite_schema: dict) -> str:
3130
3231
{chart_generation_instructions}
3332
34-
### VEGA-LITE SCHEMA SPECIFICATION ###
35-
36-
{vega_lite_schema}
37-
3833
### OUTPUT FORMAT ###
3934
4035
Please provide your chain of thought reasoning, chart type and the vega-lite schema in JSON format.
@@ -132,7 +127,7 @@ def __init__(
132127
template=chart_generation_user_prompt_template
133128
),
134129
"generator": llm_provider.get_generator(
135-
system_prompt=gen_chart_gen_system_prompt(read_vega_lite_schema()),
130+
system_prompt=gen_chart_gen_system_prompt(),
136131
generation_kwargs=CHART_GENERATION_MODEL_KWARGS,
137132
),
138133
"chart_data_preprocessor": ChartDataPreprocessor(),

0 commit comments

Comments
 (0)