Skip to content

Commit

Permalink
Merge pull request #1069 from better629/main
Browse files Browse the repository at this point in the history
fix state value extract for issues/1067
  • Loading branch information
geekan authored Mar 21, 2024
2 parents 5ee95b1 + 12551ab commit 0958cc3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion metagpt/utils/repair_llm_raw_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@ def extract_state_value_from_output(content: str) -> str:
content (str): llm's output from `Role._think`
"""
content = content.strip() # deal the output cases like " 0", "0\n" and so on.
pattern = r"([0-9])" # TODO find the number using a more proper method not just extract from content using pattern
pattern = (
r"(?<!-)[0-9]" # TODO find the number using a more proper method not just extract from content using pattern
)
matches = re.findall(pattern, content, re.DOTALL)
matches = list(set(matches))
state = matches[0] if len(matches) > 0 else "-1"
Expand Down

0 comments on commit 0958cc3

Please sign in to comment.