def validate_dataset_records(
    dataset: FeedbackDatasetBase,
    records: List[FeedbackRecord],
    attributes_to_validate: typing.Optional[List[str]] = None,
) -> None:
    """Validates the records against the schema defined by the `fields`.

    Args:
        dataset: the `FeedbackDataset` object to validate the records against.
        records: a list of `FeedbackRecord` objects to validate.
        attributes_to_validate: a list containing the name of the attributes to
            validate from the record. Valid values are: `fields`, `metadata` and `vectors`.
            If not provided, all `fields`, `metadata` and `vectors` are validated. Defaults
            to `None`.

    Raises:
        ValueError: if the `fields` schema does not match the `FeedbackRecord.fields` schema.
    """
    attributes_to_validate = attributes_to_validate or ["fields", "metadata", "vectors"]

    if "fields" in attributes_to_validate:
        fields_schema = _build_fields_schema(dataset)

    if "metadata" in attributes_to_validate:
        metadata_schema = _build_metadata_schema(dataset)

    if "vectors" in attributes_to_validate:
        vectors_settings_by_name = {
            vector_settings.name: vector_settings for vector_settings in dataset.vectors_settings or []
        }

    for record in records:
        if "fields" in attributes_to_validate:
            _validate_record_fields(record, fields_schema)

        if "metadata" in attributes_to_validate:
            _validate_record_metadata(record, metadata_schema)

        if "vectors" in attributes_to_validate:
            _validate_record_vectors(record, vectors_settings_by_name)
Validates the records against the schema defined by the `fields`.

    Args:
        dataset: the `FeedbackDataset` object to validate the records against.
        records: a list of `FeedbackRecord` objects to validate.
        attributes_to_validate: a list containing the name of the attributes to
            validate from the record. Valid values are: `fields`, `metadata` and `vectors`.
            If not provided, all `fields`, `metadata` and `vectors` are validated. Defaults
            to `None`.

    Raises:
        ValueError: if the `fields` schema does not match the `FeedbackRecord.fields` schema.
    
argilla-v1/src/argilla_v1/client/feedback/dataset/helpers.py