Debates have turns, turns have authors and messages
We’ll represent debates as lists of turns. Each turn has the name of an agent and a message from that agent. For example, including some types:
debate/types.py
Name =strMessage =strTurn = tuple[Name, Message]Debate = list[Turn]my_debate: Debate = [ ("Alice","I think we should legalize all drugs."), ("Bob","I'm against."), ("Alice","The war on drugs has been a failure. It's time to try something new."),]
Here’s how we’ll initialize and render debates:
debate/utils.py
from typing import Optionalfrom fvalues import Ffrom ice.recipes.primer.debate.types import*definitialize_debate(question: Message) -> Debate:return [ ("Question", question), ("Alice","I'm in favor."), ("Bob","I'm against."), ]defrender_debate(debate: Debate,self_name: Optional[Name]=None) ->str: debate_text =""for speaker, text in debate:if speaker == self_name: speaker ="You" debate_text +=F(f'{speaker}: "{text}"\n')return debate_text.strip()
When we render debates, we also provide the option to replace an agent name with “You”, like this: