Skip to content

Commit

Permalink
polish code
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Jul 6, 2024
1 parent 1928e57 commit 9e7aa22
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@
"projectName": "rag-springai-openai-llm",
"args": "--spring.profiles.active=local",
"envFile": "${workspaceFolder}/.env"
},
{
"type": "java",
"name": "Spring Boot-LLMRagWithSpringBoot<rag-langchain4j-AllMiniLmL6V2-llm>",
"request": "launch",
"cwd": "${workspaceFolder}",
"mainClass": "com.learning.ai.LLMRagWithSpringBoot",
"projectName": "rag-langchain4j-AllMiniLmL6V2-llm",
"args": "",
"envFile": "${workspaceFolder}/.env"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.7'
services:
postgresqldb:
container_name: postgresqldb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class LLMRagWithSpringBoot {
class LLMRagWithSpringBoot {

public static void main(String[] args) {
SpringApplication.run(LLMRagWithSpringBoot.class, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.springframework.core.io.ResourceLoader;

@Configuration(proxyBeanMethods = false)
public class AIConfig {
class AIConfig {

@Bean
AICustomerSupportAgent customerSupportAgent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@Component
@Slf4j
public class ChatTools {
class ChatTools {

/**
* This tool is available to {@link AICustomerSupportAgent}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
@OpenAPIDefinition(
info = @Info(title = "rag-langchain4j-AllMiniLmL6V2-llm", version = "v1.0.0"),
servers = @Server(url = "/"))
public class SwaggerConfig {}
class SwaggerConfig {}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@RestController
@RequestMapping("/api/ai")
@Validated
public class CustomerSupportController {
class CustomerSupportController {

private final CustomerSupportService customerSupportService;

Expand All @@ -22,7 +22,7 @@ public CustomerSupportController(CustomerSupportService customerSupportService)
}

@PostMapping("/chat")
public AICustomerSupportResponse customerSupportChat(@RequestBody @Valid AIChatRequest aiChatRequest) {
AICustomerSupportResponse customerSupportChat(@RequestBody @Valid AIChatRequest aiChatRequest) {
return customerSupportService.chat(aiChatRequest.question());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public AICustomerSupportResponse chat(String question) {
.maxResults(1)
.build();
EmbeddingSearchResult<TextSegment> relevant = embeddingStore.search(embeddingSearchRequest);
EmbeddingMatch<TextSegment> embeddingMatch = relevant.matches().get(0);
EmbeddingMatch<TextSegment> embeddingMatch = relevant.matches().getFirst();

String embeddedText = embeddingMatch.embedded().text();
return aiCustomerSupportAgent.chat(question, embeddedText);
Expand Down

0 comments on commit 9e7aa22

Please sign in to comment.