Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bigtop-manager-ai/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@
</dependency>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-qianfan</artifactId>
<artifactId>langchain4j-community-qianfan</artifactId>
</dependency>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-dashscope</artifactId>
<artifactId>langchain4j-community-dashscope</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import org.apache.bigtop.manager.ai.core.enums.PlatformType;

import dev.langchain4j.memory.ChatMemory;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.chat.StreamingChatLanguageModel;
import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.chat.StreamingChatModel;
import dev.langchain4j.service.tool.ToolProvider;
import dev.langchain4j.store.memory.chat.ChatMemoryStore;
import reactor.core.publisher.Flux;
Expand Down Expand Up @@ -82,9 +82,9 @@ interface Builder {

AIAssistant build();

ChatLanguageModel getChatLanguageModel();
ChatModel getChatModel();

StreamingChatLanguageModel getStreamingChatLanguageModel();
StreamingChatModel getStreamingChatModel();

ChatMemory getChatMemory();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
import org.apache.bigtop.manager.ai.core.enums.PlatformType;
import org.apache.bigtop.manager.ai.core.factory.AIAssistant;

import dev.langchain4j.community.model.dashscope.QwenChatModel;
import dev.langchain4j.community.model.dashscope.QwenStreamingChatModel;
import dev.langchain4j.internal.ValidationUtils;
import dev.langchain4j.memory.ChatMemory;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.chat.StreamingChatLanguageModel;
import dev.langchain4j.model.dashscope.QwenChatModel;
import dev.langchain4j.model.dashscope.QwenStreamingChatModel;
import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.chat.StreamingChatModel;
import dev.langchain4j.service.AiServices;

public class DashScopeAssistant extends AbstractAIAssistant {
Expand All @@ -49,8 +49,8 @@ public static class Builder extends AbstractAIAssistant.Builder {

public AIAssistant build() {
AIAssistant.Service aiService = AiServices.builder(AIAssistant.Service.class)
.chatLanguageModel(getChatLanguageModel())
.streamingChatLanguageModel(getStreamingChatLanguageModel())
.chatModel(getChatModel())
.streamingChatModel(getStreamingChatModel())
.chatMemory(getChatMemory())
.toolProvider(toolProvider)
.systemMessageProvider(threadId -> {
Expand All @@ -64,15 +64,15 @@ public AIAssistant build() {
}

@Override
public ChatLanguageModel getChatLanguageModel() {
public ChatModel getChatModel() {
String model = ValidationUtils.ensureNotNull(config.getModel(), "model");
String apiKey =
ValidationUtils.ensureNotNull(config.getCredentials().get("apiKey"), "apiKey");
return QwenChatModel.builder().apiKey(apiKey).modelName(model).build();
}

@Override
public StreamingChatLanguageModel getStreamingChatLanguageModel() {
public StreamingChatModel getStreamingChatModel() {
String model = ValidationUtils.ensureNotNull(config.getModel(), "model");
String apiKey =
ValidationUtils.ensureNotNull(config.getCredentials().get("apiKey"), "apiKey");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

import dev.langchain4j.internal.ValidationUtils;
import dev.langchain4j.memory.ChatMemory;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.chat.StreamingChatLanguageModel;
import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.chat.StreamingChatModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.model.openai.OpenAiStreamingChatModel;
import dev.langchain4j.service.AiServices;
Expand All @@ -50,7 +50,7 @@ public static Builder builder() {
public static class Builder extends AbstractAIAssistant.Builder {

@Override
public ChatLanguageModel getChatLanguageModel() {
public ChatModel getChatModel() {
String model = ValidationUtils.ensureNotNull(config.getModel(), "model");
String apiKey =
ValidationUtils.ensureNotNull(config.getCredentials().get("apiKey"), "apiKey");
Expand All @@ -62,7 +62,7 @@ public ChatLanguageModel getChatLanguageModel() {
}

@Override
public StreamingChatLanguageModel getStreamingChatLanguageModel() {
public StreamingChatModel getStreamingChatModel() {
String model = ValidationUtils.ensureNotNull(config.getModel(), "model");
String apiKey =
ValidationUtils.ensureNotNull(config.getCredentials().get("apiKey"), "apiKey");
Expand All @@ -75,8 +75,8 @@ public StreamingChatLanguageModel getStreamingChatLanguageModel() {

public AIAssistant build() {
AIAssistant.Service aiService = AiServices.builder(AIAssistant.Service.class)
.chatLanguageModel(getChatLanguageModel())
.streamingChatLanguageModel(getStreamingChatLanguageModel())
.chatModel(getChatModel())
.streamingChatModel(getStreamingChatModel())
.chatMemory(getChatMemory())
.toolProvider(toolProvider)
.systemMessageProvider(threadId -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

import dev.langchain4j.internal.ValidationUtils;
import dev.langchain4j.memory.ChatMemory;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.chat.StreamingChatLanguageModel;
import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.chat.StreamingChatModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.model.openai.OpenAiStreamingChatModel;
import dev.langchain4j.service.AiServices;
Expand All @@ -50,7 +50,7 @@ public static Builder builder() {
public static class Builder extends AbstractAIAssistant.Builder {

@Override
public ChatLanguageModel getChatLanguageModel() {
public ChatModel getChatModel() {
String model = ValidationUtils.ensureNotNull(config.getModel(), "model");
String apiKey =
ValidationUtils.ensureNotNull(config.getCredentials().get("apiKey"), "apiKey");
Expand All @@ -62,7 +62,7 @@ public ChatLanguageModel getChatLanguageModel() {
}

@Override
public StreamingChatLanguageModel getStreamingChatLanguageModel() {
public StreamingChatModel getStreamingChatModel() {
String model = ValidationUtils.ensureNotNull(config.getModel(), "model");
String apiKey =
ValidationUtils.ensureNotNull(config.getCredentials().get("apiKey"), "apiKey");
Expand All @@ -75,8 +75,8 @@ public StreamingChatLanguageModel getStreamingChatLanguageModel() {

public AIAssistant build() {
AIAssistant.Service aiService = AiServices.builder(AIAssistant.Service.class)
.chatLanguageModel(getChatLanguageModel())
.streamingChatLanguageModel(getStreamingChatLanguageModel())
.chatModel(getChatModel())
.streamingChatModel(getStreamingChatModel())
.chatMemory(getChatMemory())
.toolProvider(toolProvider)
.systemMessageProvider(threadId -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
import org.apache.bigtop.manager.ai.core.enums.PlatformType;
import org.apache.bigtop.manager.ai.core.factory.AIAssistant;

import dev.langchain4j.community.model.qianfan.QianfanChatModel;
import dev.langchain4j.community.model.qianfan.QianfanStreamingChatModel;
import dev.langchain4j.internal.ValidationUtils;
import dev.langchain4j.memory.ChatMemory;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.chat.StreamingChatLanguageModel;
import dev.langchain4j.model.qianfan.QianfanChatModel;
import dev.langchain4j.model.qianfan.QianfanStreamingChatModel;
import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.chat.StreamingChatModel;
import dev.langchain4j.service.AiServices;

public class QianFanAssistant extends AbstractAIAssistant {
Expand All @@ -49,8 +49,8 @@ public static class Builder extends AbstractAIAssistant.Builder {

public AIAssistant build() {
AIAssistant.Service aiService = AiServices.builder(AIAssistant.Service.class)
.chatLanguageModel(getChatLanguageModel())
.streamingChatLanguageModel(getStreamingChatLanguageModel())
.chatModel(getChatModel())
.streamingChatModel(getStreamingChatModel())
.chatMemory(getChatMemory())
.toolProvider(toolProvider)
.systemMessageProvider(threadId -> {
Expand All @@ -64,7 +64,7 @@ public AIAssistant build() {
}

@Override
public ChatLanguageModel getChatLanguageModel() {
public ChatModel getChatModel() {
String model = ValidationUtils.ensureNotNull(config.getModel(), "model");
String apiKey =
ValidationUtils.ensureNotNull(config.getCredentials().get("apiKey"), "apiKey");
Expand All @@ -78,7 +78,7 @@ public ChatLanguageModel getChatLanguageModel() {
}

@Override
public StreamingChatLanguageModel getStreamingChatLanguageModel() {
public StreamingChatModel getStreamingChatModel() {
String model = ValidationUtils.ensureNotNull(config.getModel(), "model");
String apiKey =
ValidationUtils.ensureNotNull(config.getCredentials().get("apiKey"), "apiKey");
Expand Down
11 changes: 6 additions & 5 deletions bigtop-manager-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
<micrometer.version>1.12.4</micrometer.version>
<jdbc.dm.version>8.1.2.192</jdbc.dm.version>
<sshd.version>2.15.0</sshd.version>
<langchain4j.version>0.35.0</langchain4j.version>
<langchain4j-core.version>1.0.1</langchain4j-core.version>
<langchain4j.version>1.0.1-beta6</langchain4j.version>
<mybatis-spring-boot-starter.version>3.0.3</mybatis-spring-boot-starter.version>
<pagehelper-spring-boot-starter.version>2.1.0</pagehelper-spring-boot-starter.version>
</properties>
Expand Down Expand Up @@ -256,21 +257,21 @@
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j</artifactId>
<version>${langchain4j.version}</version>
<version>${langchain4j-core.version}</version>
</dependency>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-open-ai</artifactId>
<version>${langchain4j.version}</version>
<version>${langchain4j-core.version}</version>
</dependency>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-qianfan</artifactId>
<artifactId>langchain4j-community-qianfan</artifactId>
<version>${langchain4j.version}</version>
</dependency>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-dashscope</artifactId>
<artifactId>langchain4j-community-dashscope</artifactId>
<version>${langchain4j.version}</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;

import dev.langchain4j.agent.tool.JsonSchemaProperty;
import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
import dev.langchain4j.service.tool.ToolExecutor;
import dev.langchain4j.service.tool.ToolProvider;
import dev.langchain4j.service.tool.ToolProviderResult;
Expand Down Expand Up @@ -318,7 +318,10 @@ private Boolean testFuncCalling(String platformName, String model, Map<String, S
ToolSpecification toolSpecification = ToolSpecification.builder()
.name("getFlag")
.description("Get flag based on key")
.addParameter("key", JsonSchemaProperty.STRING, JsonSchemaProperty.description("Lowercase key"))
.parameters(JsonObjectSchema.builder()
.addStringProperty("key")
.description("Lowercase key to get flag")
.build())
.build();
ToolExecutor toolExecutor = (toolExecutionRequest, memoryId) -> {
Map<String, Object> arguments = JsonUtils.readFromString(toolExecutionRequest.arguments());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

import org.springframework.stereotype.Component;

import dev.langchain4j.agent.tool.JsonSchemaProperty;
import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
import dev.langchain4j.service.tool.ToolExecutor;
import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -55,7 +55,10 @@ public Map<ToolSpecification, ToolExecutor> getClusterById() {
ToolSpecification toolSpecification = ToolSpecification.builder()
.name("getClusterById")
.description("Get cluster information based on ID")
.addParameter("clusterId", JsonSchemaProperty.NUMBER, JsonSchemaProperty.description("cluster id"))
.parameters(JsonObjectSchema.builder()
.description("Cluster ID")
.addNumberProperty("clusterId")
.build())
.build();
ToolExecutor toolExecutor = (toolExecutionRequest, memoryId) -> {
Map<String, Object> arguments = JsonUtils.readFromString(toolExecutionRequest.arguments());
Expand All @@ -74,7 +77,10 @@ public Map<ToolSpecification, ToolExecutor> getClusterByName() {
ToolSpecification toolSpecification = ToolSpecification.builder()
.name("getClusterByName")
.description("Get cluster information based on cluster name")
.addParameter("clusterName", JsonSchemaProperty.STRING, JsonSchemaProperty.description("cluster name"))
.parameters(JsonObjectSchema.builder()
.description("Cluster name")
.addStringProperty("clusterName")
.build())
.build();
ToolExecutor toolExecutor = (toolExecutionRequest, memoryId) -> {
Map<String, Object> arguments = JsonUtils.readFromString(toolExecutionRequest.arguments());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

import org.springframework.stereotype.Component;

import dev.langchain4j.agent.tool.JsonSchemaProperty;
import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
import dev.langchain4j.service.tool.ToolExecutor;
import lombok.extern.slf4j.Slf4j;

Expand All @@ -45,7 +45,10 @@ public Map<ToolSpecification, ToolExecutor> getHostById() {
ToolSpecification toolSpecification = ToolSpecification.builder()
.name("getHostById")
.description("Get host information based on ID")
.addParameter("hostId", JsonSchemaProperty.NUMBER, JsonSchemaProperty.description("host id"))
.parameters(JsonObjectSchema.builder()
.description("Host ID")
.addNumberProperty("hostId")
.build())
.build();
ToolExecutor toolExecutor = (toolExecutionRequest, memoryId) -> {
Map<String, Object> arguments = JsonUtils.readFromString(toolExecutionRequest.arguments());
Expand All @@ -64,7 +67,10 @@ public Map<ToolSpecification, ToolExecutor> getHostByName() {
ToolSpecification toolSpecification = ToolSpecification.builder()
.name("getHostByName")
.description("Get host information based on cluster name")
.addParameter("hostName", JsonSchemaProperty.STRING, JsonSchemaProperty.description("host name"))
.parameters(JsonObjectSchema.builder()
.description("Host name")
.addStringProperty("hostName")
.build())
.build();
ToolExecutor toolExecutor = (toolExecutionRequest, memoryId) -> {
Map<String, Object> arguments = JsonUtils.readFromString(toolExecutionRequest.arguments());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

import org.springframework.stereotype.Component;

import dev.langchain4j.agent.tool.JsonSchemaProperty;
import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
import dev.langchain4j.service.tool.ToolExecutor;
import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -67,10 +67,10 @@ public Map<ToolSpecification, ToolExecutor> getServiceByName() {
ToolSpecification toolSpecification = ToolSpecification.builder()
.name("getServiceByName")
.description("Get service information and configs based on service name")
.addParameter(
"serviceName",
JsonSchemaProperty.STRING,
JsonSchemaProperty.description("Lowercase service name"))
.parameters(JsonObjectSchema.builder()
.addStringProperty("serviceName")
.description("Service name")
.build())
.build();
ToolExecutor toolExecutor = (toolExecutionRequest, memoryId) -> {
Map<String, Object> arguments = JsonUtils.readFromString(toolExecutionRequest.arguments());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ VALUES
INSERT INTO llm_platform (credential, name, support_models)
VALUES
('{"apiKey": "API Key"}', 'OpenAI', 'gpt-3.5-turbo,gpt-4,gpt-4o,gpt-3.5-turbo-16k,gpt-4-turbo-preview,gpt-4-32k,gpt-4o-mini'),
('{"apiKey": "API Key"}', 'DashScope', 'qwen-1.8b-chat,qwen-max,qwen-plus,qwen-turbo'),
('{"apiKey": "API Key"}', 'DashScope', 'qwen-1.8b-chat,qwen-max,qwen-plus,qwen-turbo,qwen3-235b-a22b,qwen3-30b-a3b,qwen-plus-latest,qwen-turbo-latest'),
('{"apiKey": "API Key", "secretKey": "Secret Key"}', 'QianFan','Yi-34B-Chat,ERNIE-4.0-8K,ERNIE-3.5-128K,ERNIE-Speed-8K,Llama-2-7B-Chat,Fuyu-8B'),
('{"apiKey": "API Key"}','DeepSeek','deepseek-chat,deepseek-reasoner');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ VALUES
INSERT INTO llm_platform (credential, name, support_models)
VALUES
('{"apiKey": "API Key"}','OpenAI','gpt-3.5-turbo,gpt-4,gpt-4o,gpt-3.5-turbo-16k,gpt-4-turbo-preview,gpt-4-32k,gpt-4o-mini'),
('{"apiKey": "API Key"}','DashScope','qwen-1.8b-chat,qwen-max,qwen-plus,qwen-turbo'),
('{"apiKey": "API Key"}','DashScope','qwen-1.8b-chat,qwen-max,qwen-plus,qwen-turbo,qwen3-235b-a22b,qwen3-30b-a3b,qwen-plus-latest,qwen-turbo-latest'),
('{"apiKey": "API Key", "secretKey": "Secret Key"}','QianFan','Yi-34B-Chat,ERNIE-4.0-8K,ERNIE-3.5-128K,ERNIE-Speed-8K,Llama-2-7B-Chat,Fuyu-8B'),
('{"apiKey": "API Key"}','DeepSeek','deepseek-chat,deepseek-reasoner');

Expand Down
Loading
Loading