(improvement)(headless)Optimize prompts and exemplars

This commit is contained in:
jerryjzhang
2024-06-06 11:26:42 +08:00
parent 451ae1f6f0
commit 4a867451d5
4 changed files with 130 additions and 129 deletions

View File

@@ -65,9 +65,10 @@ public class OnePassSCSqlGenStrategy extends SqlGenStrategy {
+ "please convert it to a SQL query so that relevant answer could be returned to the user "
+ "by executing the SQL query against underlying database.\n"
+ "#Rules:\n"
+ "1.Always use `数据日期` as the date field.\n"
+ "2.Always use `datediff` function to calculate date range.\n"
+ "3.Only output SQL statement.\n"
+ "1.ALWAYS use `数据日期` as the date field.\n"
+ "2.ALWAYS use `datediff()` as the date function.\n"
+ "3.DO NOT specify date filter in the where clause if not explicitly mentioned in the query.\n"
+ "4.ONLY output SQL statement.\n"
+ "#Exemplars:\n%s"
+ "#UserQuery: %s "
+ "#DatabaseMetadata: %s "

View File

@@ -63,10 +63,10 @@ public class PromptHelper {
String fieldValue = value.getFieldValue();
priorLinkingList.add("" + fieldValue + "‘是一个‘" + fieldName + "");
}
String currentDataStr = "current date is " + currentDate;
String currentDataStr = "当前的日期是" + currentDate;
String linkingListStr = String.join("", priorLinkingList);
String termStr = getTermStr(llmReq);
String questionAugmented = String.format("%s (补充信息:%s . %s . %s) (备注: %s)", llmReq.getQueryText(),
String questionAugmented = String.format("%s (补充信息:%s;%s;%s;%s)", llmReq.getQueryText(),
linkingListStr, currentDataStr, termStr, priorExts);
return Pair.of(dbSchema, questionAugmented);