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 10
10
</parent >
11
11
12
12
<artifactId >deployment-ollama</artifactId >
13
+ <name >Deployment :: Ollama</name >
13
14
14
15
<dependencies >
15
16
<dependency >
Original file line number Diff line number Diff line change 10
10
</parent >
11
11
12
12
<artifactId >deployment-openai</artifactId >
13
+ <name >Deployment :: OpenAI</name >
13
14
14
15
<dependencies >
15
16
<dependency >
Original file line number Diff line number Diff line change 11
11
12
12
<artifactId >deployment</artifactId >
13
13
<packaging >pom</packaging >
14
+ <name >Deployment</name >
14
15
<modules >
15
16
<module >ollama</module >
16
17
<module >openai</module >
Original file line number Diff line number Diff line change 15
15
<artifactId >pdf-qa</artifactId >
16
16
<version >1.0.0-SNAPSHOT</version >
17
17
<packaging >pom</packaging >
18
+ <name >PDF QA</name >
18
19
<modules >
19
20
<module >shared</module >
20
21
<module >deployment</module >
Original file line number Diff line number Diff line change 18
18
<maven .compiler.target>${java.version} </maven .compiler.target>
19
19
<project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
20
20
<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>
22
22
</properties >
23
23
24
24
<dependencies >
25
25
<dependency >
26
26
<groupId >org.springframework.ai</groupId >
27
27
<artifactId >spring-ai-starter-vector-store-pgvector</artifactId >
28
28
</dependency >
29
+ <dependency >
30
+ <groupId >org.springframework.ai</groupId >
31
+ <artifactId >spring-ai-rag</artifactId >
32
+ </dependency >
29
33
<dependency >
30
34
<groupId >org.springframework.ai</groupId >
31
35
<artifactId >spring-ai-pdf-document-reader</artifactId >
37
41
<dependency >
38
42
<groupId >org.springdoc</groupId >
39
43
<artifactId >springdoc-openapi-starter-webmvc-ui</artifactId >
40
- <version >2.5.0 </version >
44
+ <version >2.8.8 </version >
41
45
</dependency >
42
46
<dependency >
43
47
<groupId >com.javaaidev.chatagentui</groupId >
Original file line number Diff line number Diff line change 1
1
package com .javaaidev .pdfqa ;
2
2
3
- import org .springframework .ai .chat .client .advisor .QuestionAnswerAdvisor ;
4
3
import 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 ;
6
6
import org .springframework .ai .vectorstore .VectorStore ;
7
7
import org .springframework .context .annotation .Bean ;
8
8
import org .springframework .context .annotation .Configuration ;
11
11
public class AppConfiguration {
12
12
13
13
@ 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 ();
16
18
}
17
19
18
20
@ Bean
Original file line number Diff line number Diff line change 4
4
import com .javaaidev .chatagent .model .ChatAgentResponse ;
5
5
import com .javaaidev .chatagent .springai .ModelAdapter ;
6
6
import org .springframework .ai .chat .client .ChatClient ;
7
- import org .springframework .ai .chat .client .advisor .QuestionAnswerAdvisor ;
8
7
import org .springframework .ai .chat .client .advisor .SimpleLoggerAdvisor ;
9
8
import org .springframework .ai .chat .messages .Message ;
9
+ import org .springframework .ai .rag .advisor .RetrievalAugmentationAdvisor ;
10
10
import org .springframework .http .codec .ServerSentEvent ;
11
11
import org .springframework .web .bind .annotation .PostMapping ;
12
12
import org .springframework .web .bind .annotation .RequestBody ;
@@ -19,10 +19,10 @@ public class QaController {
19
19
private final ChatClient chatClient ;
20
20
21
21
public QaController (ChatClient .Builder builder ,
22
- QuestionAnswerAdvisor questionAnswerAdvisor ,
22
+ RetrievalAugmentationAdvisor ragAdvisor ,
23
23
SimpleLoggerAdvisor simpleLoggerAdvisor ) {
24
24
this .chatClient = builder .defaultAdvisors (
25
- questionAnswerAdvisor ,
25
+ ragAdvisor ,
26
26
simpleLoggerAdvisor ).build ();
27
27
}
28
28
You can’t perform that action at this time.
0 commit comments