|
@@ -1,18 +1,53 @@
|
|
|
package com.qmth.boot.core.ai.model.llm;
|
|
|
|
|
|
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
|
+import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
+
|
|
|
import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 大模型通用chat请求
|
|
|
*/
|
|
|
+@JsonIgnoreProperties(ignoreUnknown = true)
|
|
|
public class ChatRequest {
|
|
|
|
|
|
private List<ChatMessage> messages;
|
|
|
|
|
|
+ /**
|
|
|
+ * 模型名称
|
|
|
+ */
|
|
|
private String model;
|
|
|
|
|
|
- private Boolean stream;
|
|
|
+ /**
|
|
|
+ * 是否流式输出
|
|
|
+ */
|
|
|
+ private Boolean stream = false;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 是否启用思考模式(若开启思考模式,则默认流式输出)
|
|
|
+ */
|
|
|
+ @JsonProperty("enable_thinking")
|
|
|
+ private Boolean enableThinking = false;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 采样温度 [0,2]
|
|
|
+ * 值越高生成的文本更多样,反之生成的文本越确定
|
|
|
+ */
|
|
|
+ private Float temperature;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 核采样的概率阈值 [0,1]
|
|
|
+ * 值越高生成的文本越随机,反之生成的文本更确定
|
|
|
+ */
|
|
|
+ @JsonProperty("top_p")
|
|
|
+ private Float topP;
|
|
|
+
|
|
|
+ @JsonProperty("result_format")
|
|
|
+ private String resultFormat;
|
|
|
+
|
|
|
+ // @JsonProperty("response_format")
|
|
|
+ // private String responseFormat;
|
|
|
|
|
|
public ChatRequest() {
|
|
|
this.messages = new LinkedList<>();
|
|
@@ -49,4 +84,36 @@ public class ChatRequest {
|
|
|
this.stream = stream;
|
|
|
}
|
|
|
|
|
|
+ public Boolean getEnableThinking() {
|
|
|
+ return enableThinking;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setEnableThinking(Boolean enableThinking) {
|
|
|
+ this.enableThinking = enableThinking;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Float getTemperature() {
|
|
|
+ return temperature;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setTemperature(Float temperature) {
|
|
|
+ this.temperature = temperature;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Float getTopP() {
|
|
|
+ return topP;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setTopP(Float topP) {
|
|
|
+ this.topP = topP;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getResultFormat() {
|
|
|
+ return resultFormat;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setResultFormat(String resultFormat) {
|
|
|
+ this.resultFormat = resultFormat;
|
|
|
+ }
|
|
|
+
|
|
|
}
|