def __init__(
        self,
        *,
        output_key: str,
        mode: TokenStreamMode = TokenStreamMode.JSON,
        **kwargs: dict[str, Any],
    ) -> None:
        """Constructor method.

        Args:
            output_key: chain output key.
            mode: The stream mode.
            **kwargs: Keyword arguments to pass to the parent constructor.
        """
        super().__init__(**kwargs)

        self.output_key = output_key

        if mode not in list(TokenStreamMode):
            raise ValueError(f"Invalid stream mode: {mode}")
        self.mode = mode
Constructor method.

        Args:
            output_key: chain output key.
            mode: The stream mode.
            **kwargs: Keyword arguments to pass to the parent constructor.
        
lanarky/adapters/langchain/callbacks.py