Skip to content

Commit 61d59ea

Browse files
committed
update to Spring AI 1.0.0
1 parent 12c014c commit 61d59ea

File tree

7 files changed

+19
-9
lines changed

7 files changed

+19
-9
lines changed

deployment/ollama/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
</parent>
1111

1212
<artifactId>deployment-ollama</artifactId>
13+
<name>Deployment :: Ollama</name>
1314

1415
<dependencies>
1516
<dependency>

deployment/openai/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
</parent>
1111

1212
<artifactId>deployment-openai</artifactId>
13+
<name>Deployment :: OpenAI</name>
1314

1415
<dependencies>
1516
<dependency>

deployment/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<artifactId>deployment</artifactId>
1313
<packaging>pom</packaging>
14+
<name>Deployment</name>
1415
<modules>
1516
<module>ollama</module>
1617
<module>openai</module>

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
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>

shared/pom.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@
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>
@@ -37,7 +41,7 @@
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>

shared/src/main/java/com/javaaidev/pdfqa/AppConfiguration.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.javaaidev.pdfqa;
22

3-
import org.springframework.ai.chat.client.advisor.QuestionAnswerAdvisor;
43
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;
66
import org.springframework.ai.vectorstore.VectorStore;
77
import org.springframework.context.annotation.Bean;
88
import org.springframework.context.annotation.Configuration;
@@ -11,8 +11,10 @@
1111
public 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

shared/src/main/java/com/javaaidev/pdfqa/QaController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import com.javaaidev.chatagent.model.ChatAgentResponse;
55
import com.javaaidev.chatagent.springai.ModelAdapter;
66
import org.springframework.ai.chat.client.ChatClient;
7-
import org.springframework.ai.chat.client.advisor.QuestionAnswerAdvisor;
87
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
98
import org.springframework.ai.chat.messages.Message;
9+
import org.springframework.ai.rag.advisor.RetrievalAugmentationAdvisor;
1010
import org.springframework.http.codec.ServerSentEvent;
1111
import org.springframework.web.bind.annotation.PostMapping;
1212
import 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

0 commit comments

Comments
 (0)