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 46 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a4e53c9
update
cyyeh May 14, 2025
cdd754e
improve chart adjustment
cyyeh May 14, 2025
5cb62d8
fix
cyyeh May 14, 2025
e172347
use vega-lite-schema v6
cyyeh May 14, 2025
18ca45c
update
cyyeh May 14, 2025
0a8e897
update
cyyeh May 15, 2025
4bc9130
fix
cyyeh May 15, 2025
55a1ccf
update
cyyeh May 15, 2025
86e58f6
update
cyyeh May 15, 2025
b9bcba0
update
cyyeh May 15, 2025
e6a6923
update
cyyeh May 15, 2025
956b5ae
refine chart adjustment
cyyeh May 15, 2025
3520a88
refine litellm openai format and allow adding image data to llm
cyyeh May 16, 2025
1dc2638
update
cyyeh May 19, 2025
1340844
add chart validation
cyyeh May 19, 2025
8831990
update
cyyeh May 19, 2025
4249377
skip chart validation error
cyyeh May 19, 2025
5659f76
allow chart correction
cyyeh May 20, 2025
08794a4
fix chart
cyyeh May 20, 2025
cc4087d
add chart validation and correction to chart adjustment
cyyeh May 20, 2025
b89762e
fix bug
cyyeh May 20, 2025
7738690
improve prompt
cyyeh May 20, 2025
4bc8d29
improve prompt
cyyeh May 20, 2025
534fc79
update
cyyeh May 20, 2025
89ba259
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh May 20, 2025
49bebb8
refactor
cyyeh May 20, 2025
3dd06d1
update
cyyeh May 20, 2025
569d0f5
fix
cyyeh May 20, 2025
25c96eb
refactor
cyyeh May 20, 2025
089cb6d
fix
cyyeh May 20, 2025
c0833d1
remove
cyyeh May 20, 2025
8ef858a
refactor
cyyeh May 21, 2025
d734f54
refactor
cyyeh May 21, 2025
b1c41e4
fix
cyyeh May 21, 2025
9dc3ab2
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh May 21, 2025
eac9f94
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh May 21, 2025
2f8d965
improve prompt
cyyeh May 21, 2025
44be4c7
update
cyyeh May 21, 2025
32a96bc
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh May 21, 2025
4d1dcba
update
cyyeh May 22, 2025
1d05fb3
update
cyyeh May 22, 2025
fb17cb7
update
cyyeh May 22, 2025
d10ccd6
update
cyyeh May 22, 2025
69d07fe
Merge branch 'main' into feat/ai-service/flexible-chart-gen
cyyeh May 22, 2025
a5cc75b
update font size
cyyeh May 26, 2025
7e3bfe7
update
cyyeh May 26, 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 @@ -189,6 +189,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 @@ -139,6 +139,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 @@ -136,6 +136,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 @@ -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.deepseek.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,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 @@ -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.grok.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
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 @@ -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.lm_studio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,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 @@ -137,6 +137,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 @@ -137,6 +137,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
17 changes: 16 additions & 1 deletion wren-ai-service/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.65.1"
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