diff --git a/pom.xml b/pom.xml
index 432c836..5885c8b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
org.springframework.samples
- spring-petclinic
+ spring-petclinic-langchain4j
3.4.0-SNAPSHOT
petclinic
diff --git a/src/main/java/org/springframework/samples/petclinic/chat/AssistantTool.java b/src/main/java/org/springframework/samples/petclinic/chat/AssistantTool.java
index d3c411a..02114af 100644
--- a/src/main/java/org/springframework/samples/petclinic/chat/AssistantTool.java
+++ b/src/main/java/org/springframework/samples/petclinic/chat/AssistantTool.java
@@ -48,7 +48,10 @@ public OwnersResponse getAllOwners() {
@Tool("Add a pet with the specified petTypeId, to an owner identified by the ownerId")
public AddedPetResponse addPetToOwner(AddPetRequest request) {
Owner owner = ownerRepository.findById(request.ownerId()).orElseThrow();
- owner.addPet(request.pet());
+ // Waiting for https://github.com/langchain4j/langchain4j/issues/2249
+ Pet pet = request.pet();
+ pet.setName(request.petName());
+ owner.addPet(pet);
this.ownerRepository.save(owner);
return new AddedPetResponse(owner);
}
@@ -69,7 +72,7 @@ public OwnerResponse addOwnerToPetclinic(OwnerRequest ownerRequest) {
}
-record AddPetRequest(Pet pet, Integer ownerId) {
+record AddPetRequest(Pet pet, String petName, Integer ownerId) {
}
record OwnerRequest(Owner owner) {