def _infer_modality(self, tensor_field: TensorField) -> Modality:
        """
        Infer modality based on tensor field type specified in the definition of structured index. Please note we
        do not infer the modality from the content of the field here, any modality mismatch is detected later when
        we download and preprocess the media content.
        """
        if tensor_field.field_type == FieldType.Text:
            return Modality.TEXT
        elif tensor_field.field_type == FieldType.ImagePointer:
            return Modality.IMAGE
        elif tensor_field.field_type == FieldType.VideoPointer:
            return Modality.VIDEO
        elif tensor_field.field_type == FieldType.AudioPointer:
            return Modality.AUDIO
        else:
            raise AddDocumentsError(f"Error processing {tensor_field.field_name}, tensor field type "
                                    f"{tensor_field.field_type} is not supported")

        Infer modality based on tensor field type specified in the definition of structured index. Please note we
        do not infer the modality from the content of the field here, any modality mismatch is detected later when
        we download and preprocess the media content.
        
src/marqo/core/structured_vespa_index/structured_add_document_handler.py