diff --git a/agenthub/langchains_agent/utils/prompts.py b/agenthub/langchains_agent/utils/prompts.py index 1c7f297d2081..a5dca94858ed 100644 --- a/agenthub/langchains_agent/utils/prompts.py +++ b/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']