diff --git a/rag/rag-springai-ollama-llm/pom.xml b/rag/rag-springai-ollama-llm/pom.xml index 0de8e89..852a367 100644 --- a/rag/rag-springai-ollama-llm/pom.xml +++ b/rag/rag-springai-ollama-llm/pom.xml @@ -70,10 +70,10 @@ test - org.springframework.ai - spring-ai-spring-boot-testcontainers - test - + org.springframework.ai + spring-ai-spring-boot-testcontainers + test + org.testcontainers junit-jupiter @@ -127,9 +127,9 @@ 2.47.0 - - - + + + diff --git a/rag/rag-springai-ollama-llm/src/main/java/com/learning/ai/llmragwithspringai/service/DataIndexerService.java b/rag/rag-springai-ollama-llm/src/main/java/com/learning/ai/llmragwithspringai/service/DataIndexerService.java index d07c35a..e2d2ea7 100644 --- a/rag/rag-springai-ollama-llm/src/main/java/com/learning/ai/llmragwithspringai/service/DataIndexerService.java +++ b/rag/rag-springai-ollama-llm/src/main/java/com/learning/ai/llmragwithspringai/service/DataIndexerService.java @@ -1,11 +1,9 @@ package com.learning.ai.llmragwithspringai.service; -import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.ai.chat.prompt.transformer.TransformerContentType; -import org.springframework.ai.document.Document; import org.springframework.ai.document.DocumentReader; import org.springframework.ai.document.DocumentTransformer; import org.springframework.ai.reader.ExtractedTextFormatter; @@ -53,15 +51,12 @@ public void loadData(Resource documentResource) { } if (documentReader != null) { LOGGER.info("Loading text document to redis vector database"); - var metadataEnricher = new DocumentTransformer() { - @Override - public List apply(List documents) { - documents.forEach(d -> { - Map metadata = d.getMetadata(); - metadata.put(TransformerContentType.EXTERNAL_KNOWLEDGE, "true"); - }); - return documents; - } + DocumentTransformer metadataEnricher = documents -> { + documents.forEach(d -> { + Map metadata = d.getMetadata(); + metadata.put(TransformerContentType.EXTERNAL_KNOWLEDGE, "true"); + }); + return documents; }; vectorStore.accept(metadataEnricher.apply(tokenTextSplitter.apply(documentReader.get()))); LOGGER.info("Loaded document to redis vector database."); diff --git a/rag/rag-springai-openai-llm/pom.xml b/rag/rag-springai-openai-llm/pom.xml index 98cd183..53bbfd7 100644 --- a/rag/rag-springai-openai-llm/pom.xml +++ b/rag/rag-springai-openai-llm/pom.xml @@ -120,11 +120,11 @@ - 2.40.0 + 2.47.0 - - - + + +