Add rag module: Spring AI 2.0 RAG with pgvector, chunking, reranking and a faithfulness check

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B38FGKKam5SCGgwgduVAh3
This commit is contained in:
Claude
2026-09-21 19:09:05 +00:00
commit 1d4625a1c2
62 changed files with 3715 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
# The 1.x article's code, against 1.1.0 and 2.0.1
## The starter artifact ids in the 1.x article: latest version ever published
spring-ai-openai-spring-boot-starter latest: 1.0.0-M6
spring-ai-pgvector-store-spring-boot-starter latest: 1.0.0-M6
the ids that replaced them:
spring-ai-starter-model-openai latest: 2.0.1
spring-ai-starter-vector-store-pgvector latest: 2.0.1
## mvn validate on the article's dependency block with spring-ai-bom 1.1.0
'dependencies.dependency.version' for org.springframework.ai:spring-ai-openai-spring-boot-starter:jar is missing. @ line 31, column 17
'dependencies.dependency.version' for org.springframework.ai:spring-ai-pgvector-store-spring-boot-starter:jar is missing. @ line 35, column 17
## mvn validate on the article's dependency block with spring-ai-bom 2.0.1
'dependencies.dependency.version' for org.springframework.ai:spring-ai-openai-spring-boot-starter:jar is missing. @ line 31, column 17
'dependencies.dependency.version' for org.springframework.ai:spring-ai-pgvector-store-spring-boot-starter:jar is missing. @ line 35, column 17
## javac legacy-1x/src/LegacyIngestion.java against Spring AI 1.1.0
legacy-1x/src/LegacyIngestion.java:17: error: incompatible types: ExtractedTextFormatter is not a functional interface
.withPageExtractedTextFormatter(text -> text.replaceAll("s{3,}", " "))
^
## javac legacy-1x/src/LegacyIngestion.java against Spring AI 2.0.1
legacy-1x/src/LegacyIngestion.java:17: error: incompatible types: ExtractedTextFormatter is not a functional interface
.withPageExtractedTextFormatter(text -> text.replaceAll("s{3,}", " "))
^
legacy-1x/src/LegacyIngestion.java:22: error: no suitable constructor found for TokenTextSplitter(int,int,int,int,boolean)
TokenTextSplitter splitter = new TokenTextSplitter(512, 128, 5, 10_000, true);
^
## the 1.x configuration keys in the metadata of spring-ai-autoconfigure-model-openai
1.1.0 spring.ai.openai.chat.options.model current
1.1.0 spring.ai.openai.chat.options.temperature current
1.1.0 spring.ai.openai.embedding.options.model current
2.0.1 spring.ai.openai.chat.options.model deprecated, use spring.ai.openai.chat.model
2.0.1 spring.ai.openai.chat.options.temperature deprecated, use spring.ai.openai.chat.temperature
2.0.1 spring.ai.openai.embedding.options.model deprecated, use spring.ai.openai.embedding.model