Skip to content

Commit 94f405d

Browse files
authored
Merge pull request #11 from arey/feature/spring-ai-1.0.0-M5
Upgrade Spring AI to 1.0.0-M5
2 parents 1256cdc + a22cd1e commit 94f405d

File tree

4 files changed

+263
-521
lines changed

4 files changed

+263
-521
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ apply plugin: 'io.spring.javaformat'
1515
gradle.startParameter.excludedTaskNames += [ "checkFormatAot", "checkFormatAotTest" ]
1616

1717
group = 'org.springframework.samples'
18-
version = '3.4.0'
18+
version = '3.4.2'
1919

2020
java {
2121
sourceCompatibility = JavaVersion.VERSION_17
@@ -32,7 +32,7 @@ ext.webjarsLocatorLiteVersion = "1.0.1"
3232
ext.webjarsFontawesomeVersion = "4.7.0"
3333
ext.webjarsBootstrapVersion = "5.3.3"
3434
ext.webjarsMarkedVersion = "14.1.2"
35-
ext.springAiVersion = "1.0.0-M2"
35+
ext.springAiVersion = "1.0.0-M5"
3636

3737
dependencies {
3838
// Workaround for AOT issue (https://github.com/spring-projects/spring-framework/pull/33949) -->

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<maven-checkstyle.version>3.6.0</maven-checkstyle.version>
3939
<nohttp-checkstyle.version>0.0.11</nohttp-checkstyle.version>
4040
<spring-format.version>0.0.43</spring-format.version>
41-
<spring-ai.version>1.0.0-M3</spring-ai.version>
41+
<spring-ai.version>1.0.0-M5</spring-ai.version>
4242
</properties>
4343

4444
<dependencies>

src/main/java/org/springframework/samples/petclinic/genai/AIDataProvider.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,9 @@ public VetResponse getVets(VetRequest request) throws JsonProcessingException {
5959
ObjectMapper objectMapper = new ObjectMapper();
6060
String vetAsJson = objectMapper.writeValueAsString(request.vet());
6161

62-
SearchRequest sr = SearchRequest.from(SearchRequest.defaults()).withQuery(vetAsJson).withTopK(20);
63-
if (request.vet() == null) {
64-
// Provide a limit of 50 results when zero parameters are sent
65-
sr = sr.withTopK(50);
66-
}
62+
// Provide a limit of 50 results when zero parameters are sent
63+
int topK = (request.vet() == null) ? 50 : 20;
64+
SearchRequest sr = SearchRequest.builder().query(vetAsJson).topK(topK).build();
6765

6866
List<Document> topMatches = this.vectorStore.similaritySearch(sr);
6967
List<String> results = topMatches.stream().map(Document::getContent).toList();

0 commit comments

Comments
 (0)