Browse Source

Fix summaries (#223)

* fix summarization

* fix content vs contents issue
Robert Brennan 2 years ago
parent
commit
95c128c3d6
1 changed files with 6 additions and 2 deletions
  1. 6 2
      agenthub/langchains_agent/utils/prompts.py

+ 6 - 2
agenthub/langchains_agent/utils/prompts.py

@@ -165,11 +165,15 @@ def get_request_action_prompt(
 def parse_action_response(response: str) -> Action:
     parser = JsonOutputParser(pydantic_object=_ActionDict)
     action_dict = parser.parse(response)
+    if 'content' in action_dict:
+        # The LLM gets confused here. Might as well be robust
+        action_dict['contents'] = action_dict.pop('content')
+
     action = ACTION_TYPE_TO_CLASS[action_dict["action"]](**action_dict["args"])
     return action
 
 def parse_summary_response(response: str) -> List[Action]:
     parser = JsonOutputParser(pydantic_object=NewMonologue)
     parsed = parser.parse(response)
-    thoughts = [ACTION_TYPE_TO_CLASS[t['action']](**t['args']) for t in parsed['new_monologue']]
-    return thoughts
+    #thoughts = [ACTION_TYPE_TO_CLASS[t['action']](**t['args']) for t in parsed['new_monologue']]
+    return parsed['new_monologue']