mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
Fix summaries (#223)
* fix summarization * fix content vs contents issue
This commit is contained in:
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user