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).

Discussion implements the iterator protocol: each call to next() 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 Discussion is its own iterator (__iter__ returns self), it is single-pass: once StopIteration is 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.

get_logs() Logs

Get the logs of the discussion. Can be used to export the logs to a file.

Returns:

A copy of the discussion logs.

Return type:

DiscussionLogs