-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: multi-line answer is empty from ReAct agent #7690
Comments
🤖 Hello, Thank you for bringing this issue to our attention. You're correct in your observation that the Your proposed solution of removing def extract_final_response(input_text: str) -> Tuple[str, str]:
pattern = r"\s*Thought:(.*?)Answer:(.*?)(?:$)"
match = re.search(pattern, input_text, re.DOTALL)
if not match:
raise ValueError(
"Could not extract final answer from input text: {}".format(input_text)
)
thought = match.group(1).strip()
answer = match.group(2).strip()
return thought, answer However, please note that this change could have other side effects depending on the structure of your input text. It's important to thoroughly test this modification with different scenarios to ensure it doesn't introduce new issues. As for the exact structure of the input text that the Best, SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Bug Description
Based on
extra_final_response()
fromllama_index/agent/react/output_parser.py
, the answer will be extracted until a new line character is encountered or the end of the string. In cases when the final answer spans across multiple lines, it will return an empty response.A possible fix is to remove
\n|
and just keep$
. But then what's the usability of$
there? Need to put more thinking into it though if anything else is affected by it; hence, no PR yet. Has someone encountered this before?Version
0.8.27
Steps to Reproduce
Query a ReAct agent to respond in an enumerated or bullet-list style.
Relevant Logs/Tracbacks
No response
The text was updated successfully, but these errors were encountered: