Skip to content

feat(wren-ai-service): flexible chart generation (ai-env-changed) #1652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 97 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
554adb1
update
cyyeh May 14, 2025
534fbcd
improve chart adjustment
cyyeh May 14, 2025
47e9fc9
fix
cyyeh May 14, 2025
3954299
use vega-lite-schema v6
cyyeh May 14, 2025
bff4f0f
update
cyyeh May 14, 2025
0c73128
update
cyyeh May 15, 2025
172d3ab
fix
cyyeh May 15, 2025
dc51b10
update
cyyeh May 15, 2025
8f8359d
update
cyyeh May 15, 2025
6d906d3
update
cyyeh May 15, 2025
190c003
update
cyyeh May 15, 2025
d01ac9f
refine chart adjustment
cyyeh May 15, 2025
e5e4036
refine litellm openai format and allow adding image data to llm
cyyeh May 16, 2025
aff820f
update
cyyeh May 19, 2025
04ce1c0
add chart validation
cyyeh May 19, 2025
17d1aa8
update
cyyeh May 19, 2025
d9b2421
skip chart validation error
cyyeh May 19, 2025
3bb31f0
allow chart correction
cyyeh May 20, 2025
456902f
fix chart
cyyeh May 20, 2025
5f41c40
add chart validation and correction to chart adjustment
cyyeh May 20, 2025
d200f3c
fix bug
cyyeh May 20, 2025
20c1989
improve prompt
cyyeh May 20, 2025
a100351
improve prompt
cyyeh May 20, 2025
2a0559b
update
cyyeh May 20, 2025
32f3c0a
refactor
cyyeh May 20, 2025
be472c2
update
cyyeh May 20, 2025
ec5d41f
fix
cyyeh May 20, 2025
26baf8e
refactor
cyyeh May 20, 2025
54beffc
fix
cyyeh May 20, 2025
26b40be
remove
cyyeh May 20, 2025
e81cb3f
refactor
cyyeh May 21, 2025
855c88c
refactor
cyyeh May 21, 2025
e6755bf
fix
cyyeh May 21, 2025
27b71a1
improve prompt
cyyeh May 21, 2025
9b3521f
update
cyyeh May 21, 2025
0b95f3d
update
cyyeh May 22, 2025
580ad82
update
cyyeh May 22, 2025
a6a2699
update
cyyeh May 22, 2025
60436ed
update
cyyeh May 22, 2025
81e56f7
update font size
cyyeh May 26, 2025
85c43fa
update
cyyeh May 26, 2025
7764fbc
update
cyyeh May 26, 2025
795f637
update
cyyeh May 26, 2025
027acf3
update
cyyeh May 26, 2025
7e599a1
update
cyyeh May 26, 2025
960c46d
update
cyyeh May 26, 2025
923ecba
update
cyyeh May 26, 2025
935d877
update
cyyeh May 27, 2025
ef84eaa
update
cyyeh May 27, 2025
6ee80e8
update
cyyeh May 27, 2025
cb2bcac
update
cyyeh May 27, 2025
ad686fb
update
cyyeh May 27, 2025
529cb99
update
cyyeh May 27, 2025
f5faa14
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh May 28, 2025
509b6cb
fix bug
cyyeh May 28, 2025
c0bad54
update
cyyeh May 28, 2025
c63ffae
update
cyyeh May 29, 2025
e975f0c
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh May 29, 2025
ed62f85
update
cyyeh May 29, 2025
8f1de49
update
cyyeh May 30, 2025
1d6afb7
fix
cyyeh Jun 2, 2025
78774f7
update
cyyeh Jun 2, 2025
6461095
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jun 3, 2025
30796ba
update
cyyeh Jun 4, 2025
5fdbb1c
simplifiy
cyyeh Jun 4, 2025
68e58be
fix
cyyeh Jun 4, 2025
78a4c25
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jun 4, 2025
58cec48
update
cyyeh Jun 5, 2025
37c6159
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jun 5, 2025
3b81936
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jun 6, 2025
8d371ff
update
cyyeh Jun 6, 2025
ee64da9
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jun 6, 2025
b2aefda
update
cyyeh Jun 6, 2025
bf7b9ec
update
cyyeh Jun 6, 2025
81e9728
update
cyyeh Jun 6, 2025
0094b4c
update
cyyeh Jun 6, 2025
ebb6edf
update chart
cyyeh Jun 10, 2025
7ca3d45
update
cyyeh Jun 13, 2025
70aea7b
Merge branch 'feat/ai-service/flexible-chart-gen' into chore/ai-servi…
cyyeh Jun 13, 2025
11074d8
update
cyyeh Jun 19, 2025
9716740
update
cyyeh Jun 20, 2025
2586533
Merge branch 'chore/ai-service/flexible-chart-gen-updates' into feat/…
cyyeh Jun 20, 2025
0392c32
update
cyyeh Jun 20, 2025
89b788a
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jun 20, 2025
c273523
fix chart issue
cyyeh Jun 24, 2025
b51380f
update
cyyeh Jun 24, 2025
bfbcf63
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jun 25, 2025
aee1d8c
update
cyyeh Jun 25, 2025
d4dd8da
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jun 26, 2025
ac619a2
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jun 27, 2025
53b5636
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jun 30, 2025
fda835e
update
cyyeh Jul 2, 2025
33098c3
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jul 2, 2025
164e615
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jul 2, 2025
3bc282d
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jul 3, 2025
4217bba
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jul 3, 2025
125cd79
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh Jul 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions deployment/kustomizations/base/cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ data:
document_store: qdrant
- name: sql_tables_extraction
llm: litellm_llm.default
- name: chart_validation
llm: litellm_llm.default
- name: chart_correction
llm: litellm_llm.default

---
settings:
Expand Down
4 changes: 4 additions & 0 deletions docker/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ pipes:
document_store: qdrant
- name: sql_tables_extraction
llm: litellm_llm.default
- name: chart_validation
llm: litellm_llm.default
- name: chart_correction
llm: litellm_llm.default

---
settings:
Expand Down
4 changes: 4 additions & 0 deletions wren-ai-service/docs/config_examples/config.anthropic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ pipes:
document_store: qdrant
- name: sql_tables_extraction
llm: litellm_llm.default
- name: chart_validation
llm: litellm_llm.default
- name: chart_correction
llm: litellm_llm.default

---
settings:
Expand Down
4 changes: 4 additions & 0 deletions wren-ai-service/docs/config_examples/config.azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ pipes:
document_store: qdrant
- name: sql_tables_extraction
llm: litellm_llm.default
- name: chart_validation
llm: litellm_llm.default
- name: chart_correction
llm: litellm_llm.default

---
settings:
Expand Down
4 changes: 4 additions & 0 deletions wren-ai-service/docs/config_examples/config.deepseek.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ pipes:
document_store: qdrant
- name: sql_tables_extraction
llm: litellm_llm.default
- name: chart_validation
llm: litellm_llm.default
- name: chart_correction
llm: litellm_llm.default

---
settings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ pipes:
document_store: qdrant
- name: sql_tables_extraction
llm: litellm_llm.default
- name: chart_validation
llm: litellm_llm.default
- name: chart_correction
llm: litellm_llm.default

---
settings:
Expand Down
4 changes: 4 additions & 0 deletions wren-ai-service/docs/config_examples/config.grok.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ pipes:
document_store: qdrant
- name: sql_tables_extraction
llm: litellm_llm.default
- name: chart_validation
llm: litellm_llm.default
- name: chart_correction
llm: litellm_llm.default

---
settings:
Expand Down
4 changes: 4 additions & 0 deletions wren-ai-service/docs/config_examples/config.groq.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ pipes:
document_store: qdrant
- name: sql_tables_extraction
llm: litellm_llm.default
- name: chart_validation
llm: litellm_llm.default
- name: chart_correction
llm: litellm_llm.default

---
settings:
Expand Down
4 changes: 4 additions & 0 deletions wren-ai-service/docs/config_examples/config.lm_studio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ pipes:
document_store: qdrant
- name: sql_tables_extraction
llm: litellm_llm.default
- name: chart_validation
llm: litellm_llm.default
- name: chart_correction
llm: litellm_llm.default

---
settings:
Expand Down
4 changes: 4 additions & 0 deletions wren-ai-service/docs/config_examples/config.ollama.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ pipes:
document_store: qdrant
- name: sql_tables_extraction
llm: litellm_llm.default
- name: chart_validation
llm: litellm_llm.default
- name: chart_correction
llm: litellm_llm.default

---
settings:
Expand Down
4 changes: 4 additions & 0 deletions wren-ai-service/docs/config_examples/config.open_router.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ pipes:
document_store: qdrant
- name: sql_tables_extraction
llm: litellm_llm.default
- name: chart_validation
llm: litellm_llm.default
- name: chart_correction
llm: litellm_llm.default

---
settings:
Expand Down
1,128 changes: 430 additions & 698 deletions wren-ai-service/poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions wren-ai-service/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jsonschema = "^4.23.0"
litellm = "^1.70.0"
boto3 = "^1.35.90"
qdrant-client = "==1.11.0"
vl-convert-python = "^1.7.0"

[tool.poetry.group.dev.dependencies]
pre-commit = "^3.7.1"
Expand Down
2 changes: 2 additions & 0 deletions wren-ai-service/src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class Settings(BaseSettings):
allow_sql_functions_retrieval: bool = Field(default=True)
max_histories: int = Field(default=5)
max_sql_correction_retries: int = Field(default=3)
allow_chart_validation: bool = Field(default=False)
max_chart_correction_retries: int = Field(default=3)

# engine config
engine_timeout: float = Field(default=30.0)
Expand Down
16 changes: 16 additions & 0 deletions wren-ai-service/src/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,15 @@ def create_service_container(
"chart_generation": generation.ChartGeneration(
**pipe_components["chart_generation"],
),
"chart_validation": generation.ChartValidation(
**pipe_components["chart_validation"],
),
"chart_correction": generation.ChartCorrection(
**pipe_components["chart_correction"],
),
},
allow_chart_validation=settings.allow_chart_validation,
max_chart_correction_retries=settings.max_chart_correction_retries,
**query_cache,
),
chart_adjustment_service=services.ChartAdjustmentService(
Expand All @@ -172,7 +180,15 @@ def create_service_container(
"chart_adjustment": generation.ChartAdjustment(
**pipe_components["chart_adjustment"],
),
"chart_validation": generation.ChartValidation(
**pipe_components["chart_validation"],
),
"chart_correction": generation.ChartCorrection(
**pipe_components["chart_correction"],
),
},
allow_chart_validation=settings.allow_chart_validation,
max_chart_correction_retries=settings.max_chart_correction_retries,
**query_cache,
),
sql_answer_service=services.SqlAnswerService(
Expand Down
4 changes: 4 additions & 0 deletions wren-ai-service/src/pipelines/generation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from .chart_adjustment import ChartAdjustment
from .chart_correction import ChartCorrection
from .chart_generation import ChartGeneration
from .chart_validation import ChartValidation
from .data_assistance import DataAssistance
from .followup_sql_generation import FollowUpSQLGeneration
from .followup_sql_generation_reasoning import FollowUpSQLGenerationReasoning
Expand Down Expand Up @@ -36,4 +38,6 @@
"FollowUpSQLGenerationReasoning",
"MisleadingAssistance",
"SQLTablesExtraction",
"ChartValidation",
"ChartCorrection",
]
Loading
Loading