From 86c937faef59e4d5c67668cdade2cc6ebc9d49e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Rothenb=C3=A4cher?= <thomas_alexander@hotmail.de>
Date: Thu, 27 Feb 2025 05:32:07 +0100
Subject: [PATCH] only modify delta if 'Answer:' was actually detected (#17901)

---
 llama-index-core/llama_index/core/agent/react/step.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llama-index-core/llama_index/core/agent/react/step.py b/llama-index-core/llama_index/core/agent/react/step.py
index e61e79e6c6..df63ba7698 100644
--- a/llama-index-core/llama_index/core/agent/react/step.py
+++ b/llama-index-core/llama_index/core/agent/react/step.py
@@ -691,8 +691,8 @@ class ReActAgentWorker(BaseAgentWorker):
                     start_idx + len("Answer:") :
                 ].strip()
 
-            # set delta to the content, minus the "Answer: "
-            latest_chunk.delta = latest_chunk.message.content
+                # set delta to the content, minus the "Answer: "
+                latest_chunk.delta = latest_chunk.message.content
 
             # add back the chunks that were missed
             response_stream = self._add_back_chunk_to_stream(
-- 
GitLab