mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 03:58:14 +00:00
(fix):fix python service interact (#494)
This commit is contained in:
@@ -19,6 +19,6 @@ public class OneStepsSqlGeneration implements SqlGeneration, InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
SqlGenerationFactory.addSqlGenerationForFactory(SqlGenerationMode.ONE_STEP, this);
|
||||
SqlGenerationFactory.addSqlGenerationForFactory(SqlGenerationMode.ONE_STEP_AUTO_COT, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class TwoStepCSSqlGeneration implements SqlGeneration, InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
SqlGenerationFactory.addSqlGenerationForFactory(SqlGenerationMode.TWO_STEP_CS, this);
|
||||
SqlGenerationFactory.addSqlGenerationForFactory(SqlGenerationMode.TWO_STEP_AUTO_COT_SELF_CONSISTENCY, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,6 @@ public class TwoStepSqlGeneration implements SqlGeneration, InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
SqlGenerationFactory.addSqlGenerationForFactory(SqlGenerationMode.TWO_STEP, this);
|
||||
SqlGenerationFactory.addSqlGenerationForFactory(SqlGenerationMode.TWO_STEP_AUTO_COT, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.tencent.supersonic.chat.query.llm.s2sql;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -18,7 +19,7 @@ public class LLMReq {
|
||||
|
||||
private String priorExts;
|
||||
|
||||
private SqlGenerationMode sqlGenerationMode = SqlGenerationMode.TWO_STEP;
|
||||
private SqlGenerationMode sqlGenerationMode = SqlGenerationMode.TWO_STEP_AUTO_COT_SELF_CONSISTENCY;
|
||||
|
||||
@Data
|
||||
public static class ElementValue {
|
||||
@@ -48,11 +49,13 @@ public class LLMReq {
|
||||
|
||||
public enum SqlGenerationMode {
|
||||
|
||||
ONE_STEP("ONE_STEP"),
|
||||
ONE_STEP_AUTO_COT("1_pass_auto_cot"),
|
||||
|
||||
TWO_STEP("TWO_STEP"),
|
||||
ONE_STEP_AUTO_COT_SELF_CONSISTENCY("1_pass_auto_cot_self_consistency"),
|
||||
|
||||
TWO_STEP_CS("TWO_STEP_CS");
|
||||
TWO_STEP_AUTO_COT("2_pass_auto_cot"),
|
||||
|
||||
TWO_STEP_AUTO_COT_SELF_CONSISTENCY("2_pass_auto_cot_self_consistency");
|
||||
|
||||
|
||||
private String name;
|
||||
@@ -61,6 +64,7 @@ public class LLMReq {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ async def query2sql(query_body: Mapping[str, Any]):
|
||||
else:
|
||||
filter_condition = query_body['filterCondition']
|
||||
|
||||
if 'sql_generation_mode' not in query_body:
|
||||
if 'sqlGenerationMode' not in query_body:
|
||||
raise HTTPException(status_code=400, detail="sql_generation_mode is not in query_body")
|
||||
else:
|
||||
sql_generation_mode = query_body['sql_generation_mode']
|
||||
|
||||
Reference in New Issue
Block a user