mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 04:27:39 +00:00
[improvement][Chat] Support agent permission management (#1923)
* [improvement][Chat] Support agent permission management #1143 * [improvement][chat]Iterate LLM prompts of parsing and correction. * [improvement][headless-fe] Added null-check conditions to the data formatting function. * [improvement][headless]Clean code logic of headless translator. --------- Co-authored-by: lxwcodemonkey <jolunoluo@tencent.com> Co-authored-by: tristanliu <tristanliu@tencent.com>
This commit is contained in:
@@ -36,8 +36,8 @@ public class LLMSqlCorrector extends BaseSemanticCorrector {
|
||||
+ "\n2.NO NEED to check date filters as the junior engineer seldom makes mistakes in this regard."
|
||||
+ "\n3.DO NOT miss the AGGREGATE operator of metrics, always add it as needed."
|
||||
+ "\n4.ALWAYS use `with` statement if nested aggregation is needed."
|
||||
+ "\n5.ALWAYS enclose alias created by `AS` command in underscores."
|
||||
+ "\n6.ALWAYS translate alias created by `AS` command to the same language as the `#Question`."
|
||||
+ "\n5.ALWAYS enclose alias declared by `AS` command in underscores."
|
||||
+ "\n6.Alias created by `AS` command must be in the same language ast the `Question`."
|
||||
+ "\n#Question:{{question}} #InputSQL:{{sql}} #Response:";
|
||||
|
||||
public LLMSqlCorrector() {
|
||||
|
||||
@@ -36,15 +36,13 @@ public class OnePassSCSqlGenStrategy extends SqlGenStrategy {
|
||||
+ "\n#Task: You will be provided with a natural language question asked by users,"
|
||||
+ "please convert it to a SQL query so that relevant data could be returned "
|
||||
+ "by executing the SQL query against underlying database." + "\n#Rules:"
|
||||
+ "\n1.ALWAYS generate columns and values specified in the `Schema`, DO NOT hallucinate."
|
||||
+ "\n2.ALWAYS be cautious, word in the `Schema` does not mean it must appear in the SQL."
|
||||
+ "\n3.ALWAYS specify date filter using `>`,`<`,`>=`,`<=` operator."
|
||||
+ "\n4.DO NOT include date filter in the where clause if not explicitly expressed in the `Question`."
|
||||
+ "\n5.DO NOT calculate date range using functions."
|
||||
+ "\n6.DO NOT miss the AGGREGATE operator of metrics, always add it as needed."
|
||||
+ "\n7.ALWAYS use `with` statement if nested aggregation is needed."
|
||||
+ "\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`."
|
||||
+ "\n1.SQL columns and values must be mentioned in the `Schema`, DO NOT hallucinate."
|
||||
+ "\n2.ALWAYS specify date filter using `>`,`<`,`>=`,`<=` operator."
|
||||
+ "\n3.DO NOT include date filter in the where clause if not explicitly expressed in the `Question`."
|
||||
+ "\n4.DO NOT calculate date range using functions."
|
||||
+ "\n5.ALWAYS use `with` statement if nested aggregation is needed."
|
||||
+ "\n6.ALWAYS enclose alias declared by `AS` command in underscores."
|
||||
+ "\n7.Alias created by `AS` command must be in the same language ast the `Question`."
|
||||
+ "\n#Exemplars: {{exemplar}}"
|
||||
+ "\n#Query: Question:{{question}},Schema:{{schema}},SideInfo:{{information}}";
|
||||
|
||||
|
||||
@@ -21,12 +21,6 @@ public abstract class DetailSemanticQuery extends RuleSemanticQuery {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchemaElementMatch> match(List<SchemaElementMatch> candidateElementMatches,
|
||||
ChatQueryContext queryCtx) {
|
||||
return super.match(candidateElementMatches, queryCtx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillParseInfo(ChatQueryContext chatQueryContext, Long dataSetId) {
|
||||
super.fillParseInfo(chatQueryContext, dataSetId);
|
||||
|
||||
@@ -25,12 +25,6 @@ public abstract class MetricSemanticQuery extends RuleSemanticQuery {
|
||||
queryMatcher.addOption(METRIC, REQUIRED, AT_LEAST, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchemaElementMatch> match(List<SchemaElementMatch> candidateElementMatches,
|
||||
ChatQueryContext queryCtx) {
|
||||
return super.match(candidateElementMatches, queryCtx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillParseInfo(ChatQueryContext chatQueryContext, Long dataSetId) {
|
||||
super.fillParseInfo(chatQueryContext, dataSetId);
|
||||
|
||||
Reference in New Issue
Block a user