From 02e82db43798cc9207b159a3b6f5ff7d233d33ad Mon Sep 17 00:00:00 2001 From: humberto Date: Wed, 24 Jul 2024 11:49:23 +0200 Subject: [PATCH] - Fix conflict merge impact --- .../AiServiceMethodImplementationSupport.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/aiservice/AiServiceMethodImplementationSupport.java b/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/aiservice/AiServiceMethodImplementationSupport.java index e058382ee..26193d0d2 100644 --- a/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/aiservice/AiServiceMethodImplementationSupport.java +++ b/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/aiservice/AiServiceMethodImplementationSupport.java @@ -216,9 +216,7 @@ public void accept(Response message) { if (!aiMessage.hasToolExecutionRequests()) { // If there is no tool Execution request we add the Ai Message directly in the chatMEmory - if (context.hasChatMemory()) { - context.chatMemory(memoryId).add(aiMessage); - } + chatMemory.add(aiMessage); break; } @@ -247,10 +245,9 @@ public void accept(Response message) { // In case of tool Execution request we need to update the AiMessage with tools results // before adding it into chatMemory aiMessage = variableHandler.substituteVariables(aiMessage); - if (context.hasChatMemory()) { - chatMemory.add(aiMessage); - tmpToolExecutionResultMessages.forEach(chatMemory::add); - } + + chatMemory.add(aiMessage); + tmpToolExecutionResultMessages.forEach(chatMemory::add); log.debug("Attempting to obtain AI response"); response = context.chatModel.generate(chatMemory.messages(), toolSpecifications);