增加 阿里 千问参数说明

This commit is contained in:
cherishsince 2024-03-14 20:23:13 +08:00
parent 0f73b61db2
commit 26afa04e80

View File

@ -57,8 +57,10 @@ public class QianWenApi {
public ResponseEntity<CompletionsResponse> chatCompletionEntity(ChatRequestMessage message) { public ResponseEntity<CompletionsResponse> chatCompletionEntity(ChatRequestMessage message) {
// 创建request // 创建request
CompletionsRequest request = new CompletionsRequest() CompletionsRequest request = new CompletionsRequest()
// 设置 appid
.setAppId(appId) .setAppId(appId)
.setMessages(List.of(message)) .setMessages(List.of(message))
// 返回choice message结果
.setParameters(new CompletionsRequest.Parameter().setResultFormat("message")); .setParameters(new CompletionsRequest.Parameter().setResultFormat("message"));
// //
CompletionsResponse response = client.completions(request); CompletionsResponse response = client.completions(request);
@ -74,8 +76,10 @@ public class QianWenApi {
public Flux<CompletionsResponse> chatCompletionStream(ChatRequestMessage message) { public Flux<CompletionsResponse> chatCompletionStream(ChatRequestMessage message) {
return client.streamCompletions( return client.streamCompletions(
new CompletionsRequest() new CompletionsRequest()
// 设置 appid
.setAppId(appId) .setAppId(appId)
.setMessages(List.of(message)) .setMessages(List.of(message))
//开启增量输出模式后面输出不会包含已经输出的内容
.setParameters(new CompletionsRequest.Parameter().setIncrementalOutput(true)) .setParameters(new CompletionsRequest.Parameter().setIncrementalOutput(true))
); );
} }