chore(wren-ai-service): refine multi-language prompt (#648)

* refine prompt

* remove test deps
This commit is contained in:
Chih-Yu Yeh
2024-09-05 15:33:40 +08:00
committed by GitHub
parent be7bb837d1
commit e5b68b42f2
4 changed files with 25 additions and 9 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ WORKDIR /app
COPY pyproject.toml ./
RUN poetry install --without dev,eval,demo --no-root && rm -rf $POETRY_CACHE_DIR
RUN poetry install --without dev,eval,demo,test --no-root && rm -rf $POETRY_CACHE_DIR
FROM python:3.12.0-slim-bookworm as runtime
@@ -23,19 +23,27 @@ You are a great data analyst. You are now given a task to summarize a list SQL q
You will be given a list of SQL queries and a user's question.
### INSTRUCTIONS ###
- SQL query summary must be in the same language as the user's question.
- PUT special care on whether it's traditional Chinese or simplified Chinese.
- SQL query summary must be within 10-20 words.
- SQL query summary must be human-readable and easy to understand.
- SQL query summary must be concise and to the point.
- SQL query summary must be in the same language as the user's question.
### OUTPUT FORMAT ###
Please return the result in the following JSON format:
{
"language": <LANGUAGE_IN_USER_QUESTION_STRING>,
"sql_summary_results": [
{"summary": <SQL_QUERY_SUMMARY_1>},
{"summary": <SQL_QUERY_SUMMARY_2>},
{"summary": <SQL_QUERY_SUMMARY_3>}
{
"summary": <SQL_QUERY_SUMMARY_USING_SAME_LANGUAGE_AS_USER_QUESTION_1>
{
"summary": <SQL_QUERY_SUMMARY_USING_SAME_LANGUAGE_AS_USER_QUESTION_2>
},
{
"summary": <SQL_QUERY_SUMMARY_USING_SAME_LANGUAGE_AS_USER_QUESTION_3>
},
...
]
}
"""
@@ -13,8 +13,9 @@ The final step intentionally lacks a CTE name to simulate a final execution with
- ALWAYS SHOW alias for columns and tables such as SELECT [column_name] AS [alias_column_name].
- MUST USE alias from the original SQL query.
### SUMMARY INSTRUCTIONS ###
- MUST BE in the same language as the user's question.
### SUMMARY AND DESCRIPTION GENERATION INSTRUCTIONS ###
- MUST BE in the same language as the user's question
- PUT special care on whether it's traditional Chinese or simplified Chinese.
- MUST BE human-readable and easy to understand.
- MUST BE concise and to the point.
@@ -33,13 +33,20 @@ SQL query: {{ sql }}
The final answer must be a valid JSON format as following:
{
"language": <LANGUAGE_IN_USER_QUESTION_STRING>,
"description": <SHORT_SQL_QUERY_DESCRIPTION>,
"steps: [
{
"sql": <SQL_QUERY_STRING_1>,
"summary": <SUMMARY_STRING_1>,
"summary": <SUMMARY_STRING_USING_SAME_LANGUAGE_AS_USER_QUESTION_1>,
"cte_name": <CTE_NAME_STRING_1>
}
},
{
"sql": <SQL_QUERY_STRING_2>,
"summary": <SUMMARY_STRING_USING_SAME_LANGUAGE_AS_USER_QUESTION_2>,
"cte_name": <CTE_NAME_STRING_2>
},
...
] # a list of steps
}