Quellcode durchsuchen

chore: parser fix for deepseek (#4097)

Xingyao Wang vor 1 Jahr
Ursprung
Commit
a4cc010110
1 geänderte Dateien mit 4 neuen und 0 gelöschten Zeilen
  1. 4 0
      agenthub/codeact_agent/action_parser.py

+ 4 - 0
agenthub/codeact_agent/action_parser.py

@@ -40,6 +40,10 @@ class CodeActResponseParser(ResponseParser):
         if action is None:
             return ''
         for lang in ['bash', 'ipython', 'browse']:
+            # special handling for DeepSeek: it has stop-word bug and returns </execute_ipython instead of </execute_ipython>
+            if f'</execute_{lang}' in action and f'</execute_{lang}>' not in action:
+                action = action.replace(f'</execute_{lang}', f'</execute_{lang}>')
+
             if f'<execute_{lang}>' in action and f'</execute_{lang}>' not in action:
                 action += f'</execute_{lang}>'
         return action