def _get_max_answer_length(self, dataset: Iterable[dict]) -> int:
        """Loops over the dataset and finds the longest answer length.

        Returns:
            int: The maximum answer length with an additional buffer of 10 if chain of thought is present
        """
        max_answer_length = 0
        for example in dataset:
            all_answers = [
                example[self.answer_key],
            ] + list(example.get('aliases', []))
            for answer in all_answers:
                if self.has_cot:
                    example_cot = example['chain_of_thought']
                    response = (f'{example_cot}{self.cot_delimiter}{answer}')
                else:
                    response = answer
                tokenized_response = self.tokenizer(response)['input_ids']
                assert isinstance(tokenized_response, list)
                max_answer_length = max(
                    max_answer_length,
                    len(tokenized_response),
                )
        max_answer_length = max_answer_length + (
            _MAX_ANSWER_BUFFER_LENGTH if len(self.cot_delimiter) > 0 else 0
        )
        return max_answer_length
Loops over the dataset and finds the longest answer length.

        Returns:
            int: The maximum answer length with an additional buffer of 10 if chain of thought is present
        
llmfoundry/eval/datasets/in_context_learning_evaluation.py