Fix summaries (#223)

* fix summarization

* fix content vs contents issue
This commit is contained in:
Robert Brennan
2024-03-26 16:55:00 -04:00
committed by GitHub
parent 93656f3bb3
commit 95c128c3d6

View File

@@ -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']