Skip to content

Commit

Permalink
[improvement][headless-chat]Optimize text2sql prompt.
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryjzhang committed Oct 18, 2024
1 parent c697f0d commit 482ccf3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class OnePassSCSqlGenStrategy extends SqlGenStrategy {
+ "\n8.ALWAYS enclose alias created by `AS` command in underscores."
+ "\n9.ALWAYS translate alias created by `AS` command to the same language as the `#Question`."
+ "\n#Exemplars: {{exemplar}}"
+ "\n#Question: Question:{{question}},Schema:{{schema}},SideInfo:{{information}}";
+ "\n#Query: Question:{{question}},Schema:{{schema}},SideInfo:{{information}}";

public OnePassSCSqlGenStrategy() {
ChatAppManager.register(APP_KEY, ChatApp.builder().prompt(INSTRUCTION).name("语义SQL解析")
Expand Down Expand Up @@ -92,7 +92,8 @@ public LLMResp generate(LLMReq llmReq) {
prompt2Exemplar.keySet().parallelStream().forEach(prompt -> {
SemanticSql s2Sql = extractor.generateSemanticSql(prompt.toUserMessage().singleText());
output2Prompt.put(s2Sql.getSql(), prompt);
keyPipelineLog.info("OnePassSCSqlGenStrategy modelReq:\n{} \nmodelResp:\n{}", prompt.text(), s2Sql);
keyPipelineLog.info("OnePassSCSqlGenStrategy modelReq:\n{} \nmodelResp:\n{}",
prompt.text(), s2Sql);
});

// 4.format response.
Expand Down

0 comments on commit 482ccf3

Please sign in to comment.