refactor(yudao-module-llm): 重构自动评估功能以支持多模型
- 修改 AsyncModelAccessManualService 中的 autoEvaluation 方法,增加 modelUrl 参数 - 更新 TrainHttpService 中的 autoEvaluation 方法,添加 url 参数 - 优化日志输出,增加自动响应内容的打印
This commit is contained in:
parent
11daa4436d
commit
e49bc929e0
@ -121,8 +121,9 @@ public class AsyncModelAccessManualService {
|
||||
modelCompletionsReqVO.setMessages(messages);
|
||||
modelCompletionsReqVO.setModel(modelName);
|
||||
ModelCompletionsRespVO modelCompletionsRespVO = modelService.modelCompletions(modelUrl,modelCompletionsReqVO);
|
||||
log.info("auto response {}",modelCompletionsRespVO);
|
||||
String prompt = modelCompletionsRespVO.getAnswer();
|
||||
String res = trainHttpService.autoEvaluation(prompt, datasetPrompt);
|
||||
String res = trainHttpService.autoEvaluation(modelUrl,prompt, datasetPrompt);
|
||||
|
||||
ModelAssessTaskAutoInfoDO infoDO = new ModelAssessTaskAutoInfoDO();
|
||||
infoDO.setPrompt(prompt);
|
||||
|
@ -211,7 +211,7 @@ public class TrainHttpService {
|
||||
}
|
||||
|
||||
|
||||
public String autoEvaluation(String prompt,String dataSetPrompt) {
|
||||
public String autoEvaluation(String url,String prompt,String dataSetPrompt) {
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("accept","application/json");
|
||||
map.put("Content-Type","application/json");
|
||||
@ -222,7 +222,7 @@ public class TrainHttpService {
|
||||
List<String> dimension = Stream.of("事实性错误","情感倾向性","语义连贯性").collect(Collectors.toList());
|
||||
jsonObject.put("dimension",dimension);
|
||||
String body = JSONObject.toJSONString(jsonObject);
|
||||
String res = HttpUtils.post(autoEvaluation, map, body);
|
||||
String res = HttpUtils.post(url+autoEvaluation, map, body);
|
||||
log.info(" autoEvaluation:{}", res);
|
||||
JSONObject resJson = JSONObject.parseObject(res);
|
||||
JSONObject response = resJson.getJSONObject("response");
|
||||
|
Loading…
x
Reference in New Issue
Block a user