eta.discourse.get_prior_turn

get_prior_turn(turns, agent=None)[source]

Retrieve the immediately prior turn by the specified agent(s).

Parameters:
  • turns (list[DialogueTurn]) – A list of dialogue turns in the conversation, in chronological order.

  • agent (str, optional) – The agent whose prior turn should be found (by default, find the prior turn by any agent).

Returns:

The prior turn by the given agent (if one exists).

Return type:

DialogueTurn or None