Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
history string representation shortcut (#3510)
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerp authored Mar 12, 2021
1 parent 0e082f2 commit 12ce32f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion parlai/core/torch_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def update_history(self, obs: Message, temp_history: Optional[str] = None):

self.temp_history = temp_history

def get_history_str(self):
def get_history_str(self) -> Optional[str]:
"""
Return the string version of the history.
"""
Expand Down Expand Up @@ -346,6 +346,9 @@ def _add_person_tokens(self, text, token, add_after_newln=False):
else:
return token + ' ' + text

def __str__(self) -> str:
return self.get_history_str() or ''


class TorchAgent(ABC, Agent):
"""
Expand Down

0 comments on commit 12ce32f

Please sign in to comment.