Skip to content

Commit

Permalink
using pojo instead of String as response
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Feb 27, 2024
1 parent 1cf2219 commit ccd45e8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
};
}
}
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -20,5 +21,5 @@ public interface AICustomerSupportAgent {
{documents}
"""
})
String chat(@V("documents") String documents);
AICustomerSupportResponse chat(@V("documents") String documents);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.learning.ai.domain;

public record AICustomerSupportResponse(String response) {}
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ccd45e8

Please sign in to comment.