diff --git a/src/main/java/com/devoxx/genie/chatmodel/ChatModelProvider.java b/src/main/java/com/devoxx/genie/chatmodel/ChatModelProvider.java index 9c2076e..08f455e 100644 --- a/src/main/java/com/devoxx/genie/chatmodel/ChatModelProvider.java +++ b/src/main/java/com/devoxx/genie/chatmodel/ChatModelProvider.java @@ -1,6 +1,9 @@ package com.devoxx.genie.chatmodel; +import com.devoxx.genie.chatmodel.local.gpt4all.GPT4AllChatModelFactory; +import com.devoxx.genie.chatmodel.local.jan.JanChatModelFactory; import com.devoxx.genie.chatmodel.local.lmstudio.LMStudioChatModelFactory; +import com.devoxx.genie.chatmodel.local.ollama.OllamaChatModelFactory; import com.devoxx.genie.model.ChatModel; import com.devoxx.genie.model.Constant; import com.devoxx.genie.model.LanguageModel; @@ -20,19 +23,11 @@ @Setter public class ChatModelProvider { - private static final ModelProvider DEFAULT_PROVIDER = ModelProvider.OpenAI; // Choose an appropriate default + private static final ModelProvider DEFAULT_PROVIDER = ModelProvider.OpenAI; public ChatLanguageModel getChatLanguageModel(@NotNull ChatMessageContext chatMessageContext) { ChatModel chatModel = initChatModel(chatMessageContext); - ChatModelFactory factory = getFactory(chatMessageContext); - - if (factory instanceof LMStudioChatModelFactory) { - if (factory.getModels().isEmpty()) { - throw new IllegalStateException("LMStudio is not running. Please start it and try again."); - } - } - - return factory.createChatModel(chatModel); + return getFactory(chatMessageContext).createChatModel(chatModel); } public StreamingChatLanguageModel getStreamingChatLanguageModel(@NotNull ChatMessageContext chatMessageContext) { diff --git a/src/main/java/com/devoxx/genie/chatmodel/LocalChatModelFactory.java b/src/main/java/com/devoxx/genie/chatmodel/local/LocalChatModelFactory.java similarity index 98% rename from src/main/java/com/devoxx/genie/chatmodel/LocalChatModelFactory.java rename to src/main/java/com/devoxx/genie/chatmodel/local/LocalChatModelFactory.java index bca8d13..fae7832 100644 --- a/src/main/java/com/devoxx/genie/chatmodel/LocalChatModelFactory.java +++ b/src/main/java/com/devoxx/genie/chatmodel/local/LocalChatModelFactory.java @@ -1,5 +1,6 @@ -package com.devoxx.genie.chatmodel; +package com.devoxx.genie.chatmodel.local; +import com.devoxx.genie.chatmodel.ChatModelFactory; import com.devoxx.genie.model.ChatModel; import com.devoxx.genie.model.LanguageModel; import com.devoxx.genie.model.enumarations.ModelProvider; diff --git a/src/main/java/com/devoxx/genie/chatmodel/local/gpt4all/GPT4AllChatModelFactory.java b/src/main/java/com/devoxx/genie/chatmodel/local/gpt4all/GPT4AllChatModelFactory.java index aef0ea9..0314f5f 100644 --- a/src/main/java/com/devoxx/genie/chatmodel/local/gpt4all/GPT4AllChatModelFactory.java +++ b/src/main/java/com/devoxx/genie/chatmodel/local/gpt4all/GPT4AllChatModelFactory.java @@ -1,6 +1,6 @@ package com.devoxx.genie.chatmodel.local.gpt4all; -import com.devoxx.genie.chatmodel.LocalChatModelFactory; +import com.devoxx.genie.chatmodel.local.LocalChatModelFactory; import com.devoxx.genie.model.ChatModel; import com.devoxx.genie.model.LanguageModel; import com.devoxx.genie.model.enumarations.ModelProvider; diff --git a/src/main/java/com/devoxx/genie/chatmodel/local/jan/JanChatModelFactory.java b/src/main/java/com/devoxx/genie/chatmodel/local/jan/JanChatModelFactory.java index af0fe47..ac44fa1 100644 --- a/src/main/java/com/devoxx/genie/chatmodel/local/jan/JanChatModelFactory.java +++ b/src/main/java/com/devoxx/genie/chatmodel/local/jan/JanChatModelFactory.java @@ -1,6 +1,6 @@ package com.devoxx.genie.chatmodel.local.jan; -import com.devoxx.genie.chatmodel.LocalChatModelFactory; +import com.devoxx.genie.chatmodel.local.LocalChatModelFactory; import com.devoxx.genie.model.ChatModel; import com.devoxx.genie.model.LanguageModel; import com.devoxx.genie.model.enumarations.ModelProvider; diff --git a/src/main/java/com/devoxx/genie/chatmodel/local/lmstudio/LMStudioChatModelFactory.java b/src/main/java/com/devoxx/genie/chatmodel/local/lmstudio/LMStudioChatModelFactory.java index ac51e2b..93db5fa 100644 --- a/src/main/java/com/devoxx/genie/chatmodel/local/lmstudio/LMStudioChatModelFactory.java +++ b/src/main/java/com/devoxx/genie/chatmodel/local/lmstudio/LMStudioChatModelFactory.java @@ -1,6 +1,6 @@ package com.devoxx.genie.chatmodel.local.lmstudio; -import com.devoxx.genie.chatmodel.LocalChatModelFactory; +import com.devoxx.genie.chatmodel.local.LocalChatModelFactory; import com.devoxx.genie.model.ChatModel; import com.devoxx.genie.model.LanguageModel; import com.devoxx.genie.model.enumarations.ModelProvider; diff --git a/src/main/java/com/devoxx/genie/chatmodel/local/ollama/OllamaChatModelFactory.java b/src/main/java/com/devoxx/genie/chatmodel/local/ollama/OllamaChatModelFactory.java index b9455d3..41f2400 100644 --- a/src/main/java/com/devoxx/genie/chatmodel/local/ollama/OllamaChatModelFactory.java +++ b/src/main/java/com/devoxx/genie/chatmodel/local/ollama/OllamaChatModelFactory.java @@ -1,6 +1,6 @@ package com.devoxx.genie.chatmodel.local.ollama; -import com.devoxx.genie.chatmodel.LocalChatModelFactory; +import com.devoxx.genie.chatmodel.local.LocalChatModelFactory; import com.devoxx.genie.model.ChatModel; import com.devoxx.genie.model.LanguageModel; import com.devoxx.genie.model.enumarations.ModelProvider;