syndisco.Discussion
- class Discussion(next_turn_manager: TurnManager, users: list[Actor], history_context_len: int = 5, conv_len: int = 5, seed_opinions: list[str] | None = None, seed_opinion_usernames: list[str] | None = None)
Bases:
Iterator[dict[str,str]]A job conducting a discussion between different actors (
actors.Actor).Discussionimplements the iterator protocol: each call tonext()prompts the next speaker and returns the resulting log entry. This means it can be driven step-by-step:discussion = Discussion(...) for entry in discussion: # full run print(entry["name"], entry["text"])
or consumed one turn at a time:
it = iter(discussion) first = next(it) second = next(it)
begin()is a convenience wrapper that exhausts the iterator while printing output, matching the original one-shot API.Because
Discussionis its own iterator (__iter__returnsself), it is single-pass: onceStopIterationis raised the instance is exhausted and should not be reused.- begin(verbose: bool = True) None
Run the entire discussion to completion, printing each entry when verbose is
True.This is a thin wrapper that exhausts the iterator via
tqdm(), applying verbose printing along the way.- Parameters:
verbose (bool, optional) – Whether to print each comment to stdout, defaults to
True.