File tree Expand file tree Collapse file tree 6 files changed +33
-12
lines changed Expand file tree Collapse file tree 6 files changed +33
-12
lines changed Original file line number Diff line number Diff line change 1
1
services :
2
- chroma :
3
- image : chromadb/chroma :0.6.1
2
+ postgres :
3
+ image : pgvector/pgvector :0.8.0-pg16
4
4
volumes :
5
- - chroma-data:/chroma/chroma
5
+ - postgresql-data:/var/lib/postgresql/data
6
+ environment :
7
+ POSTGRES_DB : " postgres"
8
+ POSTGRES_USER : " postgres"
9
+ POSTGRES_PASSWORD : " postgres"
6
10
ports :
7
- - " 8000:8000 "
11
+ - " 5432:5432 "
8
12
volumes :
9
- chroma -data:
13
+ postgresql -data:
Original file line number Diff line number Diff line change 37
37
<dependencies >
38
38
<dependency >
39
39
<groupId >org.springframework.ai</groupId >
40
- <artifactId >spring-ai-chroma -store-spring-boot-starter</artifactId >
40
+ <artifactId >spring-ai-pgvector -store-spring-boot-starter</artifactId >
41
41
</dependency >
42
42
<dependency >
43
43
<groupId >org.springframework.ai</groupId >
Original file line number Diff line number Diff line change 1
1
package com .javaaidev .pdfqa ;
2
2
3
3
import org .springframework .ai .chat .client .advisor .QuestionAnswerAdvisor ;
4
+ import org .springframework .ai .chat .client .advisor .SimpleLoggerAdvisor ;
4
5
import org .springframework .ai .vectorstore .SearchRequest ;
5
6
import org .springframework .ai .vectorstore .VectorStore ;
6
7
import org .springframework .context .annotation .Bean ;
@@ -14,6 +15,11 @@ public QuestionAnswerAdvisor questionAnswerAdvisor(VectorStore vectorStore) {
14
15
return new QuestionAnswerAdvisor (vectorStore , SearchRequest .builder ().topK (3 ).build ());
15
16
}
16
17
18
+ @ Bean
19
+ public SimpleLoggerAdvisor simpleLoggerAdvisor () {
20
+ return new SimpleLoggerAdvisor ();
21
+ }
22
+
17
23
@ Bean
18
24
public PDFContentLoader pdfContentLoader (VectorStore vectorStore ) {
19
25
return new PDFContentLoader (vectorStore );
Original file line number Diff line number Diff line change 2
2
3
3
import org .springframework .ai .chat .client .ChatClient ;
4
4
import org .springframework .ai .chat .client .advisor .QuestionAnswerAdvisor ;
5
+ import org .springframework .ai .chat .client .advisor .SimpleLoggerAdvisor ;
5
6
import org .springframework .web .bind .annotation .PostMapping ;
6
7
import org .springframework .web .bind .annotation .RequestBody ;
7
8
import org .springframework .web .bind .annotation .RestController ;
@@ -11,8 +12,12 @@ public class QaController {
11
12
12
13
private final ChatClient chatClient ;
13
14
14
- public QaController (ChatClient .Builder builder , QuestionAnswerAdvisor questionAnswerAdvisor ) {
15
- this .chatClient = builder .defaultAdvisors (questionAnswerAdvisor ).build ();
15
+ public QaController (ChatClient .Builder builder ,
16
+ QuestionAnswerAdvisor questionAnswerAdvisor ,
17
+ SimpleLoggerAdvisor simpleLoggerAdvisor ) {
18
+ this .chatClient = builder .defaultAdvisors (
19
+ questionAnswerAdvisor ,
20
+ simpleLoggerAdvisor ).build ();
16
21
}
17
22
18
23
@ PostMapping ("/qa" )
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ spring:
10
10
chat :
11
11
enabled : true
12
12
options :
13
- model : gpt-3.5-turbo
13
+ model : gpt-4o
14
14
temperature : 0.0
15
15
embedding :
16
16
enabled : true
Original file line number Diff line number Diff line change @@ -21,6 +21,12 @@ spring:
21
21
embedding :
22
22
enabled : false
23
23
vectorstore :
24
- chroma :
25
- collectionName : pdf-qa
26
- initializeSchema : true
24
+ pgvector :
25
+ initializeSchema : true
26
+ datasource :
27
+ url : jdbc:postgresql://localhost:5432/postgres
28
+ username : postgres
29
+ password : postgres
30
+ logging :
31
+ level :
32
+ org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor : DEBUG
You can’t perform that action at this time.
0 commit comments