Skip to content

Commit 9d58e3a

Browse files
authored
chore(wren-ai-service): minor updates (#1847)
1 parent daa0fb3 commit 9d58e3a

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
### QUESTION ###
5757
User's Question: {{ query }}
5858
Language: {{ language }}
59+
Current Time: {{ current_time }}
5960
6061
Let's think step by step.
6162
"""
@@ -81,6 +82,7 @@ def prompt(
8182
instructions=instructions,
8283
),
8384
language=configuration.language,
85+
current_time=configuration.show_current_time(),
8486
)
8587
return {"prompt": clean_up_new_lines(_prompt.get("prompt"))}
8688

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"""
4040

4141
sql_to_answer_user_prompt_template = """
42-
### Input
42+
### Inputs ###
4343
User's question: {{ query }}
4444
SQL: {{ sql }}
4545
Data:

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@
4444
{% endfor %}
4545
{% endif %}
4646
47-
### QUESTION ###
47+
### INPUTS ###
4848
User's Question: {{ query }}
4949
Language: {{ language }}
50+
Current Time: {{ current_time }}
5051
5152
Let's think step by step.
5253
"""
@@ -70,6 +71,7 @@ def prompt(
7071
instructions=instructions,
7172
),
7273
language=configuration.language,
74+
current_time=configuration.show_current_time(),
7375
)
7476
return {"prompt": clean_up_new_lines(_prompt.get("prompt"))}
7577

wren-ai-service/src/pipelines/generation/utils/sql.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ async def _classify_generation_result(
183183
### INSTRUCTIONS ###
184184
1. Think deeply and reason about the user's question, the database schema, and the user's query history if provided.
185185
2. Explicitly state the following information in the reasoning plan:
186-
if the user puts any specific timeframe(e.g. YYYY-MM-DD) in the user's question, you will put the absolute time frame in the SQL query;
187-
Otherwise, you will put the relative timeframe in the SQL query.
188-
3. For the ranking problem, you must use the ranking function, `DENSE_RANK()` to rank the results and then use `WHERE` clause to filter the results.
189-
4. For the ranking problem, you must add the ranking column to the final SELECT clause.
186+
if the user puts any specific timeframe(e.g. YYYY-MM-DD) in the user's question(excluding the value of the current time), you will put the absolute time frame in the SQL query;
187+
otherwise, you will put the relative timeframe in the SQL query.
188+
3. For the ranking problem(e.g. "top x", "bottom x", "first x", "last x"), you must use the ranking function, `DENSE_RANK()` to rank the results and then use `WHERE` clause to filter the results.
189+
4. For the ranking problem(e.g. "top x", "bottom x", "first x", "last x"), you must add the ranking column to the final SELECT clause.
190190
5. If USER INSTRUCTIONS section is provided, make sure to consider them in the reasoning plan.
191191
6. If SQL SAMPLES section is provided, make sure to consider them in the reasoning plan.
192192
7. Give a step by step reasoning plan in order to answer user's question.

0 commit comments

Comments
 (0)