Skip to content

Commit

Permalink
feat(ChatDB): ChatDB English Prompt fix
Browse files Browse the repository at this point in the history
1.ChatDB English Promopt fix
  • Loading branch information
yhjun1026 committed Nov 20, 2023
1 parent ea363a4 commit d38c9c7
Show file tree
Hide file tree
Showing 32 changed files with 41 additions and 39 deletions.
5 changes: 3 additions & 2 deletions pilot/scene/chat_data/chat_excel/excel_learning/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
The following is part of the data of the user file {file_name}. Please learn to understand the structure and content of the data and output the parsing results as required:
{data_example}
Explain the meaning and function of each column, and give a simple and clear explanation of the technical terms, If it is a Date column, please summarize the Date format like: yyyy-MM-dd HH:MM:ss.
Use the column name as the attribute name and the analysis explanation as the attribute value to form a json array and output it in the ColumnAnalysis attribute that returns the json content.
Please do not modify or translate the column names, make sure they are consistent with the given data column names.
Provide some analysis options,please think step by step.
Provide some useful analysis ideas to users from different dimensions for data.
Please return your answer in JSON format, the return format is as follows:
Please think step by step and give your answer. Make sure to answer only in JSON formatthe format is as follows:
{response}
"""

Expand Down
19 changes: 10 additions & 9 deletions pilot/scene/chat_db/auto_execute/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
{table_info}
Constraint:
1.Unless the user specifies in his question a specific number of examples he wishes to obtain, always limit your query to at most {top_k} results.
2.Please do not use columns that do not appear in the tables schema. Also be careful not to misunderstand the relationship between fields and tables in SQL.
3.Use as few tables as possible when querying.
4.Please check the correctness of the SQL and ensure that the query performance is optimized under correct conditions.
1.Please understand the user's intention based on the user's question, and use the given table structure definition to create a grammatically correct {dialect} sql. If sql is not required, answer the user's question directly..
2.Always limit the query to a maximum of {top_k} results unless the user specifies in the question the specific number of rows of data he wishes to obtain.
3.You can only use the tables provided in the table structure information to generate sql. If you cannot generate sql based on the provided table structure, please say: "The table structure information provided is not enough to generate sql queries." It is prohibited to fabricate information at will.
4.Please be careful not to mistake the relationship between tables and columns when generating SQL.
5.Please check the correctness of the SQL and ensure that the query performance is optimized under correct conditions.
User Question:
{user_input}
Expand All @@ -41,11 +42,11 @@
{table_info}
约束:
1. 请理解用户意图根据用户输入问题,使用给出表结构定义创建一个语法正确的 {dialect} sql,如果不需要sql,则直接回答用户问题。
1. 除非用户在问题中指定了他希望获得的具体数据行数,否则始终将查询限制为最多 {top_k} 个结果。
2. 只能使用表结构信息中提供的表来生成 sql,如果无法根据提供的表结构中生成 sql ,请说:“提供的表结构信息不足以生成 sql 查询。” 禁止随意捏造信息。
3. 请注意生成SQL时不要弄错表和列的关系
4. 请检查SQL的正确性,并保证正确的情况下优化查询性能
1. 请根据用户问题理解用户意图,使用给出表结构定义创建一个语法正确的 {dialect} sql,如果不需要sql,则直接回答用户问题。
2. 除非用户在问题中指定了他希望获得的具体数据行数,否则始终将查询限制为最多 {top_k} 个结果。
3. 只能使用表结构信息中提供的表来生成 sql,如果无法根据提供的表结构中生成 sql ,请说:“提供的表结构信息不足以生成 sql 查询。” 禁止随意捏造信息。
4. 请注意生成SQL时不要弄错表和列的关系
5. 请检查SQL的正确性,并保证正确的情况下优化查询性能
用户问题:
{user_input}
请一步步思考并按照以下JSON格式回复:
Expand Down
2 changes: 1 addition & 1 deletion pilot/server/static/404.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pilot/server/static/404/index.html

Large diffs are not rendered by default.

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

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

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

Loading

0 comments on commit d38c9c7

Please sign in to comment.