Skip to content

Commit

Permalink
Merge pull request #11 from arey/feature/spring-ai-1.0.0-M5
Browse files Browse the repository at this point in the history
Upgrade Spring AI to 1.0.0-M5
  • Loading branch information
arey authored Feb 16, 2025
2 parents 1256cdc + a22cd1e commit 94f405d
Show file tree
Hide file tree
Showing 4 changed files with 263 additions and 521 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ apply plugin: 'io.spring.javaformat'
gradle.startParameter.excludedTaskNames += [ "checkFormatAot", "checkFormatAotTest" ]

group = 'org.springframework.samples'
version = '3.4.0'
version = '3.4.2'

java {
sourceCompatibility = JavaVersion.VERSION_17
Expand All @@ -32,7 +32,7 @@ ext.webjarsLocatorLiteVersion = "1.0.1"
ext.webjarsFontawesomeVersion = "4.7.0"
ext.webjarsBootstrapVersion = "5.3.3"
ext.webjarsMarkedVersion = "14.1.2"
ext.springAiVersion = "1.0.0-M2"
ext.springAiVersion = "1.0.0-M5"

dependencies {
// Workaround for AOT issue (https://github.com/spring-projects/spring-framework/pull/33949) -->
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<maven-checkstyle.version>3.6.0</maven-checkstyle.version>
<nohttp-checkstyle.version>0.0.11</nohttp-checkstyle.version>
<spring-format.version>0.0.43</spring-format.version>
<spring-ai.version>1.0.0-M3</spring-ai.version>
<spring-ai.version>1.0.0-M5</spring-ai.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ public VetResponse getVets(VetRequest request) throws JsonProcessingException {
ObjectMapper objectMapper = new ObjectMapper();
String vetAsJson = objectMapper.writeValueAsString(request.vet());

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

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

0 comments on commit 94f405d

Please sign in to comment.