diff --git a/README.md b/README.md index 2e32e56..1e717a5 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # ai-playground -ai playground. Initially will be copied examples, once matured can see real time examples + +Initially will be copied and modified examples, once matured can see real time examples diff --git a/llm-rag-with-langchain4j-spring-boot/src/main/java/com/learning/ai/LLMRagWithSpringBoot.java b/llm-rag-with-langchain4j-spring-boot/src/main/java/com/learning/ai/LLMRagWithSpringBoot.java index 8b824b8..f67b8a6 100644 --- a/llm-rag-with-langchain4j-spring-boot/src/main/java/com/learning/ai/LLMRagWithSpringBoot.java +++ b/llm-rag-with-langchain4j-spring-boot/src/main/java/com/learning/ai/LLMRagWithSpringBoot.java @@ -1,7 +1,6 @@ package com.learning.ai; import com.learning.ai.config.AICustomerSupportAgent; -import java.util.Map; import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -19,7 +18,7 @@ ApplicationRunner interactiveChatRunner(AICustomerSupportAgent agent) { return args -> { var response = agent.chat("what should I know about the transition to consumer direct care network washington?"); - System.out.println(Map.of("response", response)); + System.out.println(response); }; } } diff --git a/llm-rag-with-langchain4j-spring-boot/src/main/java/com/learning/ai/config/AICustomerSupportAgent.java b/llm-rag-with-langchain4j-spring-boot/src/main/java/com/learning/ai/config/AICustomerSupportAgent.java index abcc982..9349096 100644 --- a/llm-rag-with-langchain4j-spring-boot/src/main/java/com/learning/ai/config/AICustomerSupportAgent.java +++ b/llm-rag-with-langchain4j-spring-boot/src/main/java/com/learning/ai/config/AICustomerSupportAgent.java @@ -1,5 +1,6 @@ package com.learning.ai.config; +import com.learning.ai.domain.AICustomerSupportResponse; import dev.langchain4j.service.SystemMessage; import dev.langchain4j.service.V; @@ -20,5 +21,5 @@ public interface AICustomerSupportAgent { {documents} """ }) - String chat(@V("documents") String documents); + AICustomerSupportResponse chat(@V("documents") String documents); } diff --git a/llm-rag-with-langchain4j-spring-boot/src/main/java/com/learning/ai/domain/AICustomerSupportResponse.java b/llm-rag-with-langchain4j-spring-boot/src/main/java/com/learning/ai/domain/AICustomerSupportResponse.java new file mode 100644 index 0000000..5f40d87 --- /dev/null +++ b/llm-rag-with-langchain4j-spring-boot/src/main/java/com/learning/ai/domain/AICustomerSupportResponse.java @@ -0,0 +1,3 @@ +package com.learning.ai.domain; + +public record AICustomerSupportResponse(String response) {} diff --git a/llm-rag-with-langchain4j-spring-boot/src/main/resources/application.properties b/llm-rag-with-langchain4j-spring-boot/src/main/resources/application.properties index b7d561c..8d98271 100644 --- a/llm-rag-with-langchain4j-spring-boot/src/main/resources/application.properties +++ b/llm-rag-with-langchain4j-spring-boot/src/main/resources/application.properties @@ -2,15 +2,14 @@ langchain4j.open-ai.chat-model.api-key=demo langchain4j.open-ai.chat-model.model-name=gpt-3.5-turbo langchain4j.open-ai.chat-model.temperature=0.0 langchain4j.open-ai.chat-model.timeout=PT60S -langchain4j.open-ai.chat-model.log-requests=false -langchain4j.open-ai.chat-model.log-responses=false +langchain4j.open-ai.chat-model.log-requests=true +langchain4j.open-ai.chat-model.log-responses=true -logging.level.dev.langchain4j=DEBUG -logging.level.dev.ai4j.openai4j=DEBUG +logging.level.dev.langchain4j=INFO +logging.level.dev.ai4j.openai4j=INFO spring.threads.virtual.enabled=true spring.datasource.password=postgres spring.datasource.username=postgres spring.datasource.url=jdbc:postgresql://localhost/vector_store -