(fix):fix python service interact (#494)

This commit is contained in:
Scott
2023-12-11 19:31:36 +08:00
committed by GitHub
parent 3cdfcae01c
commit f3f60af231
5 changed files with 12 additions and 8 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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']