001/* 002 * Copyright (c) 2023-2026, Agents-Flex (fuhai999@gmail.com). 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.agentsflex.core.model.chat; 017 018import com.agentsflex.core.model.config.BaseModelConfig; 019 020public class ChatConfig extends BaseModelConfig { 021 022 protected Boolean supportImage; 023 protected Boolean supportImageBase64Only; // 某些模型仅支持 base64 格式图片,比如 Ollama 部署的模型,或者某些本地化模型 024 protected Boolean supportAudio; 025 protected Boolean supportVideo; 026 protected Boolean supportTool; 027 protected Boolean supportToolMessage; 028 protected Boolean supportThinking; 029 030 // 在调用工具的时候,是否需要推理结果作为 reasoning_content 传给大模型, 比如 Deepseek 031 // 参考文档: https://api-docs.deepseek.com/zh-cn/guides/thinking_mode#%E5%B7%A5%E5%85%B7%E8%B0%83%E7%94%A8 032 protected Boolean needReasoningContentForToolMessage; 033 034 protected boolean observabilityEnabled = true; // 默认开启 035 protected boolean thinkingEnabled = false; // 默认关闭 036 protected String thinkingProtocol = "none"; // "deepseek" "qwen" "ollama" "none" 037 protected boolean logEnabled = true; 038 039 040 protected boolean retryEnabled = true; // 默认开启错误重试 041 protected int retryCount = 3; 042 protected int retryInitialDelayMs = 1000; 043 044 045 public boolean isLogEnabled() { 046 return logEnabled; 047 } 048 049 public void setLogEnabled(boolean logEnabled) { 050 this.logEnabled = logEnabled; 051 } 052 053 054 public Boolean getSupportImage() { 055 return supportImage; 056 } 057 058 public void setSupportImage(Boolean supportImage) { 059 this.supportImage = supportImage; 060 } 061 062 public boolean isSupportImage() { 063 return supportImage == null || supportImage; 064 } 065 066 public Boolean getSupportImageBase64Only() { 067 return supportImageBase64Only; 068 } 069 070 public void setSupportImageBase64Only(Boolean supportImageBase64Only) { 071 this.supportImageBase64Only = supportImageBase64Only; 072 } 073 074 public boolean isSupportImageBase64Only() { 075 return supportImageBase64Only != null && supportImageBase64Only; 076 } 077 078 public Boolean getSupportAudio() { 079 return supportAudio; 080 } 081 082 public void setSupportAudio(Boolean supportAudio) { 083 this.supportAudio = supportAudio; 084 } 085 086 public boolean isSupportAudio() { 087 return supportAudio == null || supportAudio; 088 } 089 090 public Boolean getSupportVideo() { 091 return supportVideo; 092 } 093 094 public void setSupportVideo(Boolean supportVideo) { 095 this.supportVideo = supportVideo; 096 } 097 098 public boolean isSupportVideo() { 099 return supportVideo == null || supportVideo; 100 } 101 102 public void setSupportTool(Boolean supportTool) { 103 this.supportTool = supportTool; 104 } 105 106 public Boolean getSupportTool() { 107 return supportTool; 108 } 109 110 public boolean isSupportTool() { 111 return supportTool == null || supportTool; 112 } 113 114 public Boolean getSupportToolMessage() { 115 return supportToolMessage; 116 } 117 118 public void setSupportToolMessage(Boolean supportToolMessage) { 119 this.supportToolMessage = supportToolMessage; 120 } 121 122 public boolean isSupportToolMessage() { 123 return supportToolMessage == null || supportToolMessage; 124 } 125 126 public Boolean getSupportThinking() { 127 return supportThinking; 128 } 129 130 public void setSupportThinking(Boolean supportThinking) { 131 this.supportThinking = supportThinking; 132 } 133 134 public boolean isSupportThinking() { 135 return supportThinking == null || supportThinking; 136 } 137 138 public Boolean getNeedReasoningContentForToolMessage() { 139 return needReasoningContentForToolMessage; 140 } 141 142 public void setNeedReasoningContentForToolMessage(Boolean needReasoningContentForToolMessage) { 143 this.needReasoningContentForToolMessage = needReasoningContentForToolMessage; 144 } 145 146 /** 147 * 是否需要推理结果作为 reasoning_content 传给大模型 148 * 比如 Deepseek 在工具调佣的时候,需要推理结果作为 reasoning_content 传给大模型 149 * 150 * @return 默认值为 false 151 */ 152 public boolean isNeedReasoningContentForToolMessage() { 153 return needReasoningContentForToolMessage != null && needReasoningContentForToolMessage; 154 } 155 156 public boolean isThinkingEnabled() { 157 return thinkingEnabled; 158 } 159 160 public void setThinkingEnabled(boolean thinkingEnabled) { 161 this.thinkingEnabled = thinkingEnabled; 162 } 163 164 public String getThinkingProtocol() { 165 return thinkingProtocol; 166 } 167 168 public void setThinkingProtocol(String thinkingProtocol) { 169 this.thinkingProtocol = thinkingProtocol; 170 } 171 172 public boolean isObservabilityEnabled() { 173 return observabilityEnabled; 174 } 175 176 public void setObservabilityEnabled(boolean observabilityEnabled) { 177 this.observabilityEnabled = observabilityEnabled; 178 } 179 180 public boolean isRetryEnabled() { 181 return retryEnabled; 182 } 183 184 public void setRetryEnabled(boolean retryEnabled) { 185 this.retryEnabled = retryEnabled; 186 } 187 188 public int getRetryCount() { 189 return retryCount; 190 } 191 192 public void setRetryCount(int retryCount) { 193 this.retryCount = retryCount; 194 } 195 196 public int getRetryInitialDelayMs() { 197 return retryInitialDelayMs; 198 } 199 200 public void setRetryInitialDelayMs(int retryInitialDelayMs) { 201 this.retryInitialDelayMs = retryInitialDelayMs; 202 } 203}