mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-20 06:34:55 +00:00
(improvement)(chat) Support configuring embeddingModel or embeddingStore at the agent level. (#1361)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://${DB_HOST}:3306/${DB_NAME}?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true
|
||||
url: jdbc:mysql://${DB_HOST}:${DB_PORT:3306}/${DB_NAME}?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true
|
||||
username: ${DB_USERNAME}
|
||||
password: ${DB_PASSWORD}
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
|
||||
@@ -14,11 +14,11 @@ langchain4j:
|
||||
temperature: ${OPENAI_TEMPERATURE:0.0}
|
||||
timeout: ${OPENAI_TIMEOUT:PT60S}
|
||||
|
||||
# embedding-model:
|
||||
# base-url: https://api.openai.com/v1
|
||||
# api-key: demo
|
||||
# model-name: text-embedding-3-small
|
||||
# timeout: PT60S
|
||||
# embedding-model:
|
||||
# base-url: https://api.openai.com/v1
|
||||
# api-key: demo
|
||||
# model-name: text-embedding-3-small
|
||||
# timeout: PT60S
|
||||
|
||||
in-memory:
|
||||
embedding-model:
|
||||
|
||||
@@ -8,7 +8,8 @@ import com.tencent.supersonic.chat.server.agent.AgentConfig;
|
||||
import com.tencent.supersonic.chat.server.agent.AgentToolType;
|
||||
import com.tencent.supersonic.chat.server.agent.MultiTurnConfig;
|
||||
import com.tencent.supersonic.chat.server.agent.RuleParserTool;
|
||||
import com.tencent.supersonic.common.config.LLMConfig;
|
||||
import com.tencent.supersonic.common.config.ChatModelConfig;
|
||||
import com.tencent.supersonic.common.config.ModelConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.QueryResult;
|
||||
import com.tencent.supersonic.util.DataUtils;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@@ -85,7 +86,8 @@ public class Text2SQLEval extends BaseTest {
|
||||
AgentConfig agentConfig = new AgentConfig();
|
||||
agentConfig.getTools().add(getLLMQueryTool());
|
||||
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
|
||||
agent.setLlmConfig(getLLMConfig(LLMType.GPT));
|
||||
agent.setModelConfig(getLLMConfig(LLMType.GPT));
|
||||
agent.setLlmConfig(getLLMConfig(LLMType.GPT).getChatModel());
|
||||
MultiTurnConfig multiTurnConfig = new MultiTurnConfig();
|
||||
multiTurnConfig.setEnableMultiTurn(enableMultiturn);
|
||||
agent.setMultiTurnConfig(multiTurnConfig);
|
||||
@@ -108,7 +110,7 @@ public class Text2SQLEval extends BaseTest {
|
||||
GLM
|
||||
}
|
||||
|
||||
private static LLMConfig getLLMConfig(LLMType type) {
|
||||
private static ModelConfig getLLMConfig(LLMType type) {
|
||||
String baseUrl;
|
||||
String apiKey;
|
||||
String modelName;
|
||||
@@ -143,9 +145,16 @@ public class Text2SQLEval extends BaseTest {
|
||||
modelName = "gpt-3.5-turbo";
|
||||
temperature = 0.0;
|
||||
}
|
||||
ChatModelConfig chatModel = new ChatModelConfig();
|
||||
chatModel.setModelName(modelName);
|
||||
chatModel.setBaseUrl(baseUrl);
|
||||
chatModel.setApiKey(apiKey);
|
||||
chatModel.setTemperature(temperature);
|
||||
chatModel.setProvider("open_ai");
|
||||
|
||||
return new LLMConfig("open_ai",
|
||||
baseUrl, apiKey, modelName, temperature);
|
||||
ModelConfig modelConfig = new ModelConfig();
|
||||
modelConfig.setChatModel(chatModel);
|
||||
return modelConfig;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user