Skip to content

Commit

Permalink
Use lambda expression
Browse files Browse the repository at this point in the history
  • Loading branch information
arey committed Dec 27, 2024
1 parent 4891c1f commit 457855b
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
public class AIDataProvider {

private final VectorStore vectorStore;
private String ownersHostname = "http://customers-service/";
private final String ownersHostname = "http://customers-service/";

private final WebClient webClient;


public AIDataProvider(WebClient.Builder webClientBuilder, VectorStore vectorStore) {
this.webClient = webClientBuilder.build();
this.vectorStore = vectorStore;
Expand All @@ -54,12 +54,11 @@ public VetResponse getVets(VetRequest request) throws JsonProcessingException {
}

List<Document> topMatches = this.vectorStore.similaritySearch(sr);
List<String> results = topMatches.stream().map(document -> document.getContent()).toList();
List<String> results = topMatches.stream().map(Document::getContent).toList();
return new VetResponse(results);
}

public AddedPetResponse addPetToOwner(AddPetRequest request) {

return new AddedPetResponse(webClient
.post()
.uri(ownersHostname + "owners/"+request.ownerId()+"/pets")
Expand All @@ -73,7 +72,6 @@ public OwnerResponse addOwnerToPetclinic(OwnerRequest ownerRequest) {
.uri(ownersHostname + "owners")
.bodyValue(ownerRequest)
.retrieve().bodyToMono(OwnerDetails.class).block());

}

}

0 comments on commit 457855b

Please sign in to comment.