mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
(improvement)(chat) Modify the default URL and model of zhipu, and enable search support for qwen. (#1578)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package dev.langchain4j.model.zhipu;
|
||||
|
||||
public enum ChatCompletionModel {
|
||||
GLM_4("glm-4"),
|
||||
GLM_3_TURBO("glm-3-turbo"),
|
||||
CHATGLM_TURBO("chatglm_turbo");
|
||||
|
||||
private final String value;
|
||||
|
||||
ChatCompletionModel(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package dev.langchain4j.model.zhipu;
|
||||
|
||||
import dev.ai4j.openai4j.chat.ChatCompletionModel;
|
||||
import dev.langchain4j.agent.tool.ToolSpecification;
|
||||
import dev.langchain4j.data.message.AiMessage;
|
||||
import dev.langchain4j.data.message.ChatMessage;
|
||||
@@ -55,7 +54,7 @@ public class ZhipuAiChatModel implements ChatLanguageModel {
|
||||
this.baseUrl = getOrDefault(baseUrl, "https://open.bigmodel.cn/");
|
||||
this.temperature = getOrDefault(temperature, 0.7);
|
||||
this.topP = topP;
|
||||
this.model = getOrDefault(model, ChatCompletionModel.GPT_4.toString());
|
||||
this.model = getOrDefault(model, ChatCompletionModel.GLM_4.toString());
|
||||
this.maxRetries = getOrDefault(maxRetries, 3);
|
||||
this.maxToken = getOrDefault(maxToken, 512);
|
||||
this.client = ZhipuAiClient.builder()
|
||||
|
||||
@@ -13,7 +13,6 @@ import org.springframework.stereotype.Service;
|
||||
public class DashscopeModelFactory implements ModelFactory, InitializingBean {
|
||||
public static final String PROVIDER = "DASHSCOPE";
|
||||
public static final String DEFAULT_BASE_URL = "https://dashscope.aliyuncs.com/api/v1";
|
||||
public static final String DEFAULT_COMPATIBLE_BASE_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1";
|
||||
|
||||
@Override
|
||||
public ChatLanguageModel createChatModel(ChatModelConfig modelConfig) {
|
||||
@@ -24,6 +23,7 @@ public class DashscopeModelFactory implements ModelFactory, InitializingBean {
|
||||
.temperature(modelConfig.getTemperature() == null ? 0L :
|
||||
modelConfig.getTemperature().floatValue())
|
||||
.topP(modelConfig.getTopP())
|
||||
.enableSearch(modelConfig.getEnableSearch())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package dev.langchain4j.provider;
|
||||
|
||||
import com.tencent.supersonic.common.pojo.EmbeddingStoreConfig;
|
||||
import dev.langchain4j.store.embedding.EmbeddingStore;
|
||||
|
||||
public interface EmbeddingStoreFactory {
|
||||
EmbeddingStore createEmbeddingStore(EmbeddingStoreConfig config);
|
||||
}
|
||||
@@ -12,8 +12,7 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class ZhipuModelFactory implements ModelFactory, InitializingBean {
|
||||
public static final String PROVIDER = "ZHIPU";
|
||||
public static final String DEFAULT_BASE_URL = "https://open.bigmodel.cn/api/paas/v4";
|
||||
public static final String DEFAULT_EMBEDDING_BASE_URL = "https://open.bigmodel.cn/";
|
||||
public static final String DEFAULT_BASE_URL = "https://open.bigmodel.cn/";
|
||||
|
||||
@Override
|
||||
public ChatLanguageModel createChatModel(ChatModelConfig modelConfig) {
|
||||
|
||||
Reference in New Issue
Block a user