Skip to main content

ResponseWordsTerminator

Terminate agent when some words reached to occurrence limit by any message of the response. Parameters:
  • words_dict (dict): Dictionary of words and its occurrence threshold.
  • case_sensitive (bool): Whether count the words as case-sensitive. (default: :obj:False)
  • mode (TerminationMode): Whether terminate agent if any or all pre-set words reached the threshold. (default: :obj:TerminationMode.ANY)

init

_validate

is_terminated

Whether terminate the agent by checking the occurrence of specified words reached to preset thresholds. Parameters:
  • messages (list): List of :obj:BaseMessage from a response.
Returns: tuple: A tuple containing whether the agent should be terminated and a string of termination reason.

reset

Reset the terminator.