diff --git a/headless/chat/src/main/java/com/tencent/supersonic/headless/chat/parser/llm/OnePassSCSqlGenStrategy.java b/headless/chat/src/main/java/com/tencent/supersonic/headless/chat/parser/llm/OnePassSCSqlGenStrategy.java index c9ce6c0de..779427aa5 100644 --- a/headless/chat/src/main/java/com/tencent/supersonic/headless/chat/parser/llm/OnePassSCSqlGenStrategy.java +++ b/headless/chat/src/main/java/com/tencent/supersonic/headless/chat/parser/llm/OnePassSCSqlGenStrategy.java @@ -35,9 +35,9 @@ public class OnePassSCSqlGenStrategy extends SqlGenStrategy { + "\n4.DO NOT calculate date range using functions." + "\n5.DO NOT miss the AGGREGATE operator of metrics, always add it as needed." + "\n6.ALWAYS use `with` statement if nested aggregation is needed." - + "\n7.ALWAYS add prefix `as_` to any alias created by the `AS` command." - + "\n#Exemplars:\n{{exemplar}}" - + "\n#Question:\nQuestion:{{question}},Schema:{{schema}},SideInfo:{{information}}"; + + "\n7.ALWAYS enclose alias created by `AS` command in underscores and translate to the same language as the `Question`." + + "\n#Exemplars: {{exemplar}}" + + "\n#Question: Question:{{question}},Schema:{{schema}},SideInfo:{{information}}"; @Data static class SemanticSql { @@ -94,7 +94,7 @@ public class OnePassSCSqlGenStrategy extends SqlGenStrategy { private Prompt generatePrompt(LLMReq llmReq, LLMResp llmResp) { StringBuilder exemplars = new StringBuilder(); for (Text2SQLExemplar exemplar : llmReq.getDynamicExemplars()) { - String exemplarStr = String.format("Question:%s,Schema:%s,SideInfo:%s,SQL:%s\n", + String exemplarStr = String.format("\nQuestion:%s,Schema:%s,SideInfo:%s,SQL:%s", exemplar.getQuestion(), exemplar.getDbSchema(), exemplar.getSideInfo(), exemplar.getSql()); exemplars.append(exemplarStr);