Skip to content

Commit

Permalink
chore(wren-ai-service): fix followup ask (#1256)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyyeh authored Feb 4, 2025
1 parent ed8c3e2 commit 78794a8
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- First, try to recognize adjectives in the user's question that are important to the user's intent.
- Second, change the adjectives to more specific and clear ones that can be matched to columns in the database schema.
- Third, only if the user's question contains time/date related information, take the current time into consideration and add time/date format(such as YYYY-MM-DD) in the rephrased_question output.
- Fourth, if the user's input contains previous SQLs, consider them to make the rephrased question.
- MUST use the rephrased user's question to make the intent classification.
- MUST put the rephrased user's question in the rephrased_question output.
- REASONING MUST be within 20 words.
Expand Down Expand Up @@ -100,7 +101,7 @@
### INPUT ###
{% if query_history %}
User's previous questions: {{ query_history }}
User's previous SQLs: {{ query_history }}
{% endif %}
User's question: {{query}}
Current Time: {{ current_time }}
Expand Down Expand Up @@ -221,14 +222,10 @@ def prompt(
history: Optional[AskHistory] = None,
configuration: Configuration | None = None,
) -> dict:
previous_query_summaries = (
[step.summary for step in history.steps if step.summary] if history else []
)

return prompt_builder.run(
query=query,
db_schemas=construct_db_schemas,
query_history=previous_query_summaries,
query_history=history.sql if history else [],
current_time=configuration.show_current_time(),
)

Expand Down

0 comments on commit 78794a8

Please sign in to comment.