File tree Expand file tree Collapse file tree 7 files changed +19
-9
lines changed
src/main/java/com/javaaidev/pdfqa Expand file tree Collapse file tree 7 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 1010 </parent >
1111
1212 <artifactId >deployment-ollama</artifactId >
13+ <name >Deployment :: Ollama</name >
1314
1415 <dependencies >
1516 <dependency >
Original file line number Diff line number Diff line change 1010 </parent >
1111
1212 <artifactId >deployment-openai</artifactId >
13+ <name >Deployment :: OpenAI</name >
1314
1415 <dependencies >
1516 <dependency >
Original file line number Diff line number Diff line change 1111
1212 <artifactId >deployment</artifactId >
1313 <packaging >pom</packaging >
14+ <name >Deployment</name >
1415 <modules >
1516 <module >ollama</module >
1617 <module >openai</module >
Original file line number Diff line number Diff line change 1515 <artifactId >pdf-qa</artifactId >
1616 <version >1.0.0-SNAPSHOT</version >
1717 <packaging >pom</packaging >
18+ <name >PDF QA</name >
1819 <modules >
1920 <module >shared</module >
2021 <module >deployment</module >
Original file line number Diff line number Diff line change 1818 <maven .compiler.target>${java.version} </maven .compiler.target>
1919 <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
2020 <chat-agent-ui .version>0.11.0</chat-agent-ui .version>
21- <llm-agent-spec .version>0.1.2 </llm-agent-spec .version>
21+ <llm-agent-spec .version>0.2.1 </llm-agent-spec .version>
2222 </properties >
2323
2424 <dependencies >
2525 <dependency >
2626 <groupId >org.springframework.ai</groupId >
2727 <artifactId >spring-ai-starter-vector-store-pgvector</artifactId >
2828 </dependency >
29+ <dependency >
30+ <groupId >org.springframework.ai</groupId >
31+ <artifactId >spring-ai-rag</artifactId >
32+ </dependency >
2933 <dependency >
3034 <groupId >org.springframework.ai</groupId >
3135 <artifactId >spring-ai-pdf-document-reader</artifactId >
3741 <dependency >
3842 <groupId >org.springdoc</groupId >
3943 <artifactId >springdoc-openapi-starter-webmvc-ui</artifactId >
40- <version >2.5.0 </version >
44+ <version >2.8.8 </version >
4145 </dependency >
4246 <dependency >
4347 <groupId >com.javaaidev.chatagentui</groupId >
Original file line number Diff line number Diff line change 11package com .javaaidev .pdfqa ;
22
3- import org .springframework .ai .chat .client .advisor .QuestionAnswerAdvisor ;
43import org .springframework .ai .chat .client .advisor .SimpleLoggerAdvisor ;
5- import org .springframework .ai .vectorstore .SearchRequest ;
4+ import org .springframework .ai .rag .advisor .RetrievalAugmentationAdvisor ;
5+ import org .springframework .ai .rag .retrieval .search .VectorStoreDocumentRetriever ;
66import org .springframework .ai .vectorstore .VectorStore ;
77import org .springframework .context .annotation .Bean ;
88import org .springframework .context .annotation .Configuration ;
1111public class AppConfiguration {
1212
1313 @ Bean
14- public QuestionAnswerAdvisor questionAnswerAdvisor (VectorStore vectorStore ) {
15- return new QuestionAnswerAdvisor (vectorStore , SearchRequest .builder ().topK (3 ).build ());
14+ public RetrievalAugmentationAdvisor questionAnswerAdvisor (VectorStore vectorStore ) {
15+ return RetrievalAugmentationAdvisor .builder ().documentRetriever (
16+ VectorStoreDocumentRetriever .builder ().vectorStore (vectorStore ).build ()
17+ ).build ();
1618 }
1719
1820 @ Bean
Original file line number Diff line number Diff line change 44import com .javaaidev .chatagent .model .ChatAgentResponse ;
55import com .javaaidev .chatagent .springai .ModelAdapter ;
66import org .springframework .ai .chat .client .ChatClient ;
7- import org .springframework .ai .chat .client .advisor .QuestionAnswerAdvisor ;
87import org .springframework .ai .chat .client .advisor .SimpleLoggerAdvisor ;
98import org .springframework .ai .chat .messages .Message ;
9+ import org .springframework .ai .rag .advisor .RetrievalAugmentationAdvisor ;
1010import org .springframework .http .codec .ServerSentEvent ;
1111import org .springframework .web .bind .annotation .PostMapping ;
1212import org .springframework .web .bind .annotation .RequestBody ;
@@ -19,10 +19,10 @@ public class QaController {
1919 private final ChatClient chatClient ;
2020
2121 public QaController (ChatClient .Builder builder ,
22- QuestionAnswerAdvisor questionAnswerAdvisor ,
22+ RetrievalAugmentationAdvisor ragAdvisor ,
2323 SimpleLoggerAdvisor simpleLoggerAdvisor ) {
2424 this .chatClient = builder .defaultAdvisors (
25- questionAnswerAdvisor ,
25+ ragAdvisor ,
2626 simpleLoggerAdvisor ).build ();
2727 }
2828
You can’t perform that action at this time.
0 commit comments