Skip to content

Commit

Permalink
Fix summaries (All-Hands-AI#223)
Browse files Browse the repository at this point in the history
* fix summarization

* fix content vs contents issue
  • Loading branch information
rbren authored Mar 26, 2024
1 parent 93656f3 commit 95c128c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions agenthub/langchains_agent/utils/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

0 comments on commit 95c128c

Please sign in to comment.