mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-13 21:17:08 +00:00
[improvement][project]Optimize log files and outputs.
This commit is contained in:
@@ -33,7 +33,7 @@ public class MemoryReviewTask {
|
||||
|
||||
public static final String APP_KEY = "MEMORY_REVIEW";
|
||||
private static final String INSTRUCTION = ""
|
||||
+ "\n#Role: You are a senior data engineer experienced in writing SQL."
|
||||
+ "#Role: You are a senior data engineer experienced in writing SQL."
|
||||
+ "\n#Task: Your will be provided with a user question and the SQL written by a junior engineer,"
|
||||
+ "please take a review and give your opinion." + "\n#Rules: "
|
||||
+ "\n1.ALWAYS follow the output format: `opinion=(POSITIVE|NEGATIVE),comment=(your comment)`."
|
||||
@@ -82,12 +82,11 @@ public class MemoryReviewTask {
|
||||
String promptStr = createPromptString(m, chatApp.getPrompt());
|
||||
Prompt prompt = PromptTemplate.from(promptStr).apply(Collections.EMPTY_MAP);
|
||||
|
||||
keyPipelineLog.info("MemoryReviewTask reqPrompt:\n{}", promptStr);
|
||||
ChatLanguageModel chatLanguageModel =
|
||||
ModelProvider.getChatModel(ModelConfigHelper.getChatModelConfig(chatApp));
|
||||
if (Objects.nonNull(chatLanguageModel)) {
|
||||
String response = chatLanguageModel.generate(prompt.toUserMessage()).content().text();
|
||||
keyPipelineLog.info("MemoryReviewTask modelResp:\n{}", response);
|
||||
keyPipelineLog.info("MemoryReviewTask modelReq:\n{} \nmodelResp:\n{}", promptStr, response);
|
||||
processResponse(response, m);
|
||||
} else {
|
||||
log.debug("ChatLanguageModel not found for agent:{}", chatAgent.getId());
|
||||
|
||||
@@ -203,13 +203,11 @@ public class NL2SQLParser implements ChatQueryParser {
|
||||
variables.put("history_sql", histSQL);
|
||||
|
||||
Prompt prompt = PromptTemplate.from(chatApp.getPrompt()).apply(variables);
|
||||
keyPipelineLog.info("QueryRewrite reqPrompt:{}", prompt.text());
|
||||
|
||||
ChatLanguageModel chatLanguageModel =
|
||||
ModelProvider.getChatModel(ModelConfigHelper.getChatModelConfig(chatApp));
|
||||
Response<AiMessage> response = chatLanguageModel.generate(prompt.toUserMessage());
|
||||
String rewrittenQuery = response.content().text();
|
||||
keyPipelineLog.info("QueryRewrite modelResp:{}", rewrittenQuery);
|
||||
keyPipelineLog.info("QueryRewrite modelReq:\n{} \nmodelResp:\n{}", prompt.text(), response);
|
||||
parseContext.setQueryText(rewrittenQuery);
|
||||
QueryNLReq rewrittenQueryNLReq = QueryReqConverter.buildText2SqlQueryReq(parseContext);
|
||||
MapResp rewrittenQueryMapResult = chatLayerService.map(rewrittenQueryNLReq);
|
||||
@@ -238,12 +236,11 @@ public class NL2SQLParser implements ChatQueryParser {
|
||||
variables.put("examples", exampleStr);
|
||||
|
||||
Prompt prompt = PromptTemplate.from(chatApp.getPrompt()).apply(variables);
|
||||
keyPipelineLog.info("ErrorRewrite reqPrompt:{}", prompt.text());
|
||||
ChatLanguageModel chatLanguageModel =
|
||||
ModelProvider.getChatModel(ModelConfigHelper.getChatModelConfig(chatApp));
|
||||
Response<AiMessage> response = chatLanguageModel.generate(prompt.toUserMessage());
|
||||
String rewrittenMsg = response.content().text();
|
||||
keyPipelineLog.info("ErrorRewrite modelResp:{}", rewrittenMsg);
|
||||
keyPipelineLog.info("ErrorRewrite modelReq:\n{} \nmodelResp:\n{}", prompt.text(), response);
|
||||
|
||||
return rewrittenMsg;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user