def to_datasets(records: List[Union["Record", Tuple["Record", float]]], dataset: "Dataset") -> HFDataset:
        """
        Export the records to a Hugging Face dataset.

        Returns:
            The dataset containing the records.
        """
        record_dicts = GenericIO.to_dict(records, flatten=True)
        hf_dataset = HFDataset.from_dict(record_dicts)
        hf_dataset = HFDatasetsIO._uncast_argilla_attributes_to_datasets(hf_dataset, dataset.schema)
        return hf_dataset

        Export the records to a Hugging Face dataset.

        Returns:
            The dataset containing the records.
        
argilla/src/argilla/records/_io/_datasets.py