Skip to content

Commit

Permalink
Removed "{"
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahonanhin committed Dec 3, 2024
1 parent da7c2e8 commit 0977c1d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions libs/langchain/langchain/agents/react/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,10 @@ def create_react_agent(
class CustomReActOutputParser(ReActSingleInputOutputParser):
def parse(self, text: str) -> str:
if "iteration limit exceeded" in text.lower():
raise ValueError("Agent terminated due to iteration limit."}

raise ValueError("Agent terminated due to iteration limit.")
reasoning_history = getattr(self, "_reasoning_history", [])
if text in reasoning_history:
raise ValueError("Detected repetitive reasoning. Terminating.")

reasoning_history.append(text)

setattr(self, "_reasoning_history", reasoning_history[-3:])
Expand Down

0 comments on commit 0977c1d

Please sign in to comment.