|
|
@@ -1,14 +1,17 @@
|
|
|
package cn.qinys.langchain4j;
|
|
|
|
|
|
+import dev.langchain4j.community.model.dashscope.QwenChatModel;
|
|
|
import dev.langchain4j.model.chat.ChatModel;
|
|
|
import dev.langchain4j.model.openai.OpenAiChatModel;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
-import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
|
|
|
|
|
|
-@EnabledIfEnvironmentVariable(named = "OPENAI_API_KEY", matches = ".+")
|
|
|
class LangchainApplicationTest {
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * deepseek
|
|
|
+ * sk-0df22b3937db44949f783afa152cd064
|
|
|
+ */
|
|
|
@Test
|
|
|
void test1() {
|
|
|
ChatModel chatModel = OpenAiChatModel.builder()
|
|
|
@@ -20,4 +23,23 @@ class LangchainApplicationTest {
|
|
|
System.out.println(answer);
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void test2() {
|
|
|
+ ChatModel chatModel = OpenAiChatModel.builder()
|
|
|
+ .baseUrl("https://api.deepseek.com/v1")
|
|
|
+ .apiKey("sk-0df22b3937db44949f783afa152cd064")
|
|
|
+ .modelName("deepseek-chat")
|
|
|
+ .build();
|
|
|
+ String answer = chatModel.chat("你好,你是谁?");
|
|
|
+ System.out.println(answer);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void test3() {
|
|
|
+ ChatModel chatModel = QwenChatModel.builder()
|
|
|
+ .apiKey("sk-0df22b3937db44949f783afa152cd064")
|
|
|
+ .build();
|
|
|
+ String answer = chatModel.chat("你好,你是谁?");
|
|
|
+ }
|
|
|
+
|
|
|
}
|