def set_state()

in aidial_sdk/chat_completion/choice.py [0:0]


    def set_state(self, state: Any) -> None:
        if self._state_submitted:
            raise runtime_error('Trying to set "state" twice')

        if not self._opened:
            raise runtime_error("Trying to append state to an unopened choice")
        if self._closed:
            raise runtime_error("Trying to append state to a closed choice")

        self._state_submitted = True
        self.send_chunk(StateChunk(self._index, state))