def run_chain_of_thought(
    thoughts: Sequence[
        Callable[[interactive_document.InteractiveDocument, str, str], str]
    ],
    premise: str,
    document: interactive_document.InteractiveDocument,
    active_player_name: str,
):
  """Run a chain of thoughts in the document.

  Args:
    thoughts: sequence of 'thought' functions each of which process a document
      and candidate event string.
    premise:  the starting premise of the chain
    document: the working document
    active_player_name: name of player whose turn it currently is

  Returns:
    document: the final version of the document that recorded the chain
    conclusion: the result of the last thought
  """
  conclusion = premise

  for f in thoughts:
    conclusion = f(document, premise, active_player_name)
    premise = conclusion
  return document, conclusion
Run a chain of thoughts in the document.

  Args:
    thoughts: sequence of 'thought' functions each of which process a document
      and candidate event string.
    premise:  the starting premise of the chain
    document: the working document
    active_player_name: name of player whose turn it currently is

  Returns:
    document: the final version of the document that recorded the chain
    conclusion: the result of the last thought
  
concordia/thought_chains/thought_chains.py