def _get_contrastive_samples(
        self,
        query_text: str,
        positive_response: str,
        negative_responses: list[str],
    ) -> dict[str, Union[str, list[str]]]:
        """Flatten contrastive samples into a list of strings.

        Args:
            query_text (str): The query text.
            positive_response (str): The positive response.
            negative_responses (List[str]): The negative responses.

        Returns:
            Dict[str, Union[str, List[str]]]: The contrastive samples, with keys 'query', 'positive', and 'negative'.
        """
        query_text = f'{self.prepend_query}{query_text}{self.append_token}'
        positive_response = f'{self.prepend_passage}{positive_response}{self.append_token}'
        if self.shuffle_hard_negatives:
            self._generator.shuffle(negative_responses)
        negative_responses = negative_responses[:self.max_hard_negatives]
        negative_responses = [
            f'{self.prepend_passage}{response}{self.append_token}'
            for response in negative_responses
        ]
        return {
            'query': query_text,
            'positive': positive_response,
            'negative': negative_responses,
        }
Flatten contrastive samples into a list of strings.

        Args:
            query_text (str): The query text.
            positive_response (str): The positive response.
            negative_responses (List[str]): The negative responses.

        Returns:
            Dict[str, Union[str, List[str]]]: The contrastive samples, with keys 'query', 'positive', and 'negative'.
        
llmfoundry/data/contrastive_pairs/dataloader.py