(improvement)(chat) add linking value switch and rename use.s2SQL.switch parameters (#376)

This commit is contained in:
lexluo09
2023-11-13 20:22:25 +08:00
committed by GitHub
parent 47be92d5f6
commit 551a376b00
3 changed files with 11 additions and 4 deletions

View File

@@ -39,7 +39,7 @@ public class OptimizationConfig {
@Value("${candidate.threshold}")
private Double candidateThreshold;
@Value("${user.s2SQL.switch:false}")
@Value("${use.s2SQL.switch:false}")
private boolean useS2SqlSwitch;
@Value("${embedding.mapper.word.min:4}")
@@ -59,4 +59,7 @@ public class OptimizationConfig {
@Value("${embedding.mapper.distance.threshold:0.58}")
private Double embeddingMapperDistanceThreshold;
@Value("${use.linking.value.switch:true}")
private boolean useLinkingValueSwitch;
}

View File

@@ -11,6 +11,7 @@ import com.tencent.supersonic.chat.api.pojo.SchemaElementType;
import com.tencent.supersonic.chat.api.pojo.SemanticSchema;
import com.tencent.supersonic.chat.api.pojo.request.QueryReq;
import com.tencent.supersonic.chat.config.LLMParserConfig;
import com.tencent.supersonic.chat.config.OptimizationConfig;
import com.tencent.supersonic.chat.parser.SatisfactionChecker;
import com.tencent.supersonic.chat.query.llm.s2sql.LLMReq;
import com.tencent.supersonic.chat.query.llm.s2sql.LLMReq.ElementValue;
@@ -59,9 +60,10 @@ public class LLMRequestService {
private AgentService agentService;
@Autowired
private SchemaService schemaService;
@Autowired
private RestTemplate restTemplate;
@Autowired
private OptimizationConfig optimizationConfig;
public boolean check(QueryContext queryCtx) {
QueryReq request = queryCtx.getRequest();
@@ -128,7 +130,9 @@ public class LLMRequestService {
llmReq.setSchema(llmSchema);
List<ElementValue> linking = new ArrayList<>();
linking.addAll(getValueList(queryCtx, modelId, semanticSchema));
if (optimizationConfig.isUseLinkingValueSwitch()) {
linking.addAll(getValueList(queryCtx, modelId, semanticSchema));
}
llmReq.setLinking(linking);
String currentDate = S2SQLDateHelper.getReferenceDate(modelId);

View File

@@ -8,4 +8,4 @@ long.text.threshold=0.8
short.text.threshold=0.5
query.text.length.threshold=10
candidate.threshold=0.2
user.s2SQL.switch=true
use.s2SQL.switch=true