结构化输出
This commit is contained in:
parent
9d95e3bff1
commit
ade5b50e33
@ -32,4 +32,16 @@ public class LangChainController {
|
||||
String result = langChainService.chat(message);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 结构化输出
|
||||
*
|
||||
* @param message 输入信息
|
||||
* @return ai返回结果
|
||||
*/
|
||||
@PostMapping("/chatForReport")
|
||||
public R<LangChainService.Report> chatForReport(@RequestBody String message) {
|
||||
LangChainService.Report result = langChainService.chatForReport(message);
|
||||
return R.ok(result);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package com.huangge1199.ai.service;
|
||||
|
||||
import dev.langchain4j.service.SystemMessage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* LangChainService
|
||||
*
|
||||
@ -12,4 +14,9 @@ public interface LangChainService {
|
||||
|
||||
@SystemMessage(fromResource = "system-prompt.txt")
|
||||
String chat(String message);
|
||||
|
||||
@SystemMessage(fromResource = "system-prompt.txt")
|
||||
Report chatForReport(String message);
|
||||
|
||||
record Report(String name, List<String> list){}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user