修复了code/chapter1/FirstAgentTest里面关于报错的bug#344
Open
yoyofancy wants to merge 1 commit intodatawhalechina:mainfrom
Open
修复了code/chapter1/FirstAgentTest里面关于报错的bug#344yoyofancy wants to merge 1 commit intodatawhalechina:mainfrom
yoyofancy wants to merge 1 commit intodatawhalechina:mainfrom
Conversation
原代码为: r"Finish\[(.*)\]", action_str).group(1)
报错为:Traceback (most recent call last):
File "/Users/mac/Documents/cs_self_learning/helloagent/旅游规划agent/ systemprompt.py", line 195, in <module>
final_answer = re.match(r"Finish\[(.*)\]", action_str).group(1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'
打印action_str以后发现里面有很多换行键。
修改为:final_answer = re.match(r"Finish\[(.*)\]", action_str, re.DOTALL).group(1)
就可以解决了
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
原代码为: r"Finish[(.)]", action_str).group(1)
报错为:Traceback (most recent call last):
File "/Users/mac/Documents/cs_self_learning/helloagent/旅游规划agent/ systemprompt.py", line 195, in
final_answer = re.match(r"Finish[(.)]", action_str).group(1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'
打印action_str以后发现里面有很多换行键。
修改为:final_answer = re.match(r"Finish[(.*)]", action_str, re.DOTALL).group(1) 就可以解决了