Skip to content

Commit

Permalink
[improvement][chat]Expose default prompt template to facilitate custo…
Browse files Browse the repository at this point in the history
…mization.
  • Loading branch information
jerryjzhang committed Sep 20, 2024
1 parent 2c7758d commit c547a27
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.tencent.supersonic.chat.server.service.AgentService;
import com.tencent.supersonic.chat.server.util.LLMConnHelper;
import com.tencent.supersonic.common.pojo.ChatModelConfig;
import com.tencent.supersonic.headless.chat.parser.llm.OnePassSCSqlGenStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down Expand Up @@ -52,11 +53,6 @@ public boolean deleteAgent(@PathVariable("id") Integer id) {
return true;
}

@PostMapping("/testLLMConn")
public boolean testLLMConn(@RequestBody ChatModelConfig modelConfig) {
return LLMConnHelper.testConnection(modelConfig);
}

@RequestMapping("/getAgentList")
public List<Agent> getAgentList() {
return agentService.getAgents();
Expand All @@ -66,4 +62,14 @@ public List<Agent> getAgentList() {
public Map<AgentToolType, String> getToolTypes() {
return AgentToolType.getToolTypes();
}

@PostMapping("/testLLMConn")
public boolean testLLMConn(@RequestBody ChatModelConfig modelConfig) {
return LLMConnHelper.testConnection(modelConfig);
}

@RequestMapping("/promptTemplate")
public String getPromptTemplate() {
return OnePassSCSqlGenStrategy.INSTRUCTION;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@Slf4j
public class OnePassSCSqlGenStrategy extends SqlGenStrategy {

private static final String INSTRUCTION =
public static final String INSTRUCTION =
""
+ "\n#Role: You are a data analyst experienced in SQL languages."
+ "\n#Task: You will be provided with a natural language question asked by users,"
Expand Down

0 comments on commit c547a27

Please sign in to comment.