unitxt.serializers module

class unitxt.serializers.DefaultListSerializer(data_classification_policy: List[str] = None, _requirements_list: List[str] | Dict[str, str] = [], requirements: List[str] | Dict[str, str] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: str | NoneType = None, to_field: str | NoneType = None, field_to_field: List[List[str]] | Dict[str, str] | NoneType = None, use_query: bool | NoneType = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False)[source]

Bases: Serializer

class unitxt.serializers.DefaultSerializer(data_classification_policy: List[str] = None, _requirements_list: List[str] | Dict[str, str] = [], requirements: List[str] | Dict[str, str] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: str | NoneType = None, to_field: str | NoneType = None, field_to_field: List[List[str]] | Dict[str, str] | NoneType = None, use_query: bool | NoneType = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False)[source]

Bases: Serializer

class unitxt.serializers.DialogSerializer(data_classification_policy: List[str] = None, _requirements_list: Union[List[str], Dict[str, str]] = [], requirements: Union[List[str], Dict[str, str]] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: Union[str, NoneType] = None, to_field: Union[str, NoneType] = None, field_to_field: Union[List[List[str]], Dict[str, str], NoneType] = None, use_query: Union[bool, NoneType] = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False, serialized_type: object = <function NewType.<locals>.new_type at 0x7867c5c59280>)[source]

Bases: SingleTypeSerializer

serialized_type()[source]

AbstractField(default: Any = <class ‘unitxt.dataclass.Undefined’>, name: str = None, type: None = None, init: bool = True, also_positional: bool = True, default_factory: Any = None, final: bool = False, abstract: bool = False, required: bool = False, internal: bool = False, origin_cls: None = None, metadata: Dict[str, str] = <factory>)

class unitxt.serializers.DictAsJsonSerializer(data_classification_policy: List[str] = None, _requirements_list: Union[List[str], Dict[str, str]] = [], requirements: Union[List[str], Dict[str, str]] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: Union[str, NoneType] = None, to_field: Union[str, NoneType] = None, field_to_field: Union[List[List[str]], Dict[str, str], NoneType] = None, use_query: Union[bool, NoneType] = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False, serialized_type: object = <class 'dict'>)[source]

Bases: SingleTypeSerializer

serialized_type

alias of dict

class unitxt.serializers.DocumentSerializer(data_classification_policy: List[str] = None, _requirements_list: Union[List[str], Dict[str, str]] = [], requirements: Union[List[str], Dict[str, str]] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: Union[str, NoneType] = None, to_field: Union[str, NoneType] = None, field_to_field: Union[List[List[str]], Dict[str, str], NoneType] = None, use_query: Union[bool, NoneType] = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False, serialized_type: object = <class 'unitxt.types.Document'>)[source]

Bases: SingleTypeSerializer

serialized_type[source]

alias of Document

class unitxt.serializers.ImageSerializer(data_classification_policy: List[str] = None, _requirements_list: Union[List[str], Dict[str, str]] = [], requirements: Union[List[str], Dict[str, str]] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: Union[str, NoneType] = None, to_field: Union[str, NoneType] = None, field_to_field: Union[List[List[str]], Dict[str, str], NoneType] = None, use_query: Union[bool, NoneType] = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False, serialized_type: object = <class 'unitxt.types.Image'>)[source]

Bases: SingleTypeSerializer

serialized_type[source]

alias of Image

class unitxt.serializers.ListSerializer(data_classification_policy: List[str] = None, _requirements_list: Union[List[str], Dict[str, str]] = [], requirements: Union[List[str], Dict[str, str]] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: Union[str, NoneType] = None, to_field: Union[str, NoneType] = None, field_to_field: Union[List[List[str]], Dict[str, str], NoneType] = None, use_query: Union[bool, NoneType] = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False, serialized_type: object = <class 'list'>)[source]

Bases: SingleTypeSerializer

serialized_type

alias of list

class unitxt.serializers.MultiDocumentSerializer(data_classification_policy: List[str] = None, _requirements_list: Union[List[str], Dict[str, str]] = [], requirements: Union[List[str], Dict[str, str]] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: Union[str, NoneType] = None, to_field: Union[str, NoneType] = None, field_to_field: Union[List[List[str]], Dict[str, str], NoneType] = None, use_query: Union[bool, NoneType] = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False, serialized_type: object = <function NewType.<locals>.new_type at 0x7867c5c59790>)[source]

Bases: DocumentSerializer

serialized_type()[source]

AbstractField(default: Any = <class ‘unitxt.dataclass.Undefined’>, name: str = None, type: None = None, init: bool = True, also_positional: bool = True, default_factory: Any = None, final: bool = False, abstract: bool = False, required: bool = False, internal: bool = False, origin_cls: None = None, metadata: Dict[str, str] = <factory>)

class unitxt.serializers.MultiTypeSerializer(data_classification_policy: List[str] = None, _requirements_list: Union[List[str], Dict[str, str]] = [], requirements: Union[List[str], Dict[str, str]] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: Union[str, NoneType] = None, to_field: Union[str, NoneType] = None, field_to_field: Union[List[List[str]], Dict[str, str], NoneType] = None, use_query: Union[bool, NoneType] = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False, serializers: List[unitxt.serializers.SingleTypeSerializer] = [DocumentSerializer(__type__='document_serializer', __title__=None, __description__=None, __tags__={}, __deprecated_msg__=None, data_classification_policy=None, requirements=[], caching=None, apply_to_streams=None, dont_apply_to_streams=None, field=None, to_field=None, field_to_field=None, use_query=None, process_every_value=False, get_default=None, not_exist_ok=False, not_exist_do_nothing=False, serialized_type=<class 'unitxt.types.Document'>), DialogSerializer(__type__='dialog_serializer', __title__=None, __description__=None, __tags__={}, __deprecated_msg__=None, data_classification_policy=None, requirements=[], caching=None, apply_to_streams=None, dont_apply_to_streams=None, field=None, to_field=None, field_to_field=None, use_query=None, process_every_value=False, get_default=None, not_exist_ok=False, not_exist_do_nothing=False, serialized_type=<function NewType.<locals>.new_type at 0x7867c5c59280>), MultiDocumentSerializer(__type__='multi_document_serializer', __title__=None, __description__=None, __tags__={}, __deprecated_msg__=None, data_classification_policy=None, requirements=[], caching=None, apply_to_streams=None, dont_apply_to_streams=None, field=None, to_field=None, field_to_field=None, use_query=None, process_every_value=False, get_default=None, not_exist_ok=False, not_exist_do_nothing=False, serialized_type=<function NewType.<locals>.new_type at 0x7867c5c59790>), ImageSerializer(__type__='image_serializer', __title__=None, __description__=None, __tags__={}, __deprecated_msg__=None, data_classification_policy=None, requirements=[], caching=None, apply_to_streams=None, dont_apply_to_streams=None, field=None, to_field=None, field_to_field=None, use_query=None, process_every_value=False, get_default=None, not_exist_ok=False, not_exist_do_nothing=False, serialized_type=<class 'unitxt.types.Image'>), VideoSerializer(__type__='video_serializer', __title__=None, __description__=None, __tags__={}, __deprecated_msg__=None, data_classification_policy=None, requirements=[], caching=None, apply_to_streams=None, dont_apply_to_streams=None, field=None, to_field=None, field_to_field=None, use_query=None, process_every_value=False, get_default=None, not_exist_ok=False, not_exist_do_nothing=False, serialized_type=<function NewType.<locals>.new_type at 0x7867c5c59b80>), TableSerializer(__type__='table_serializer', __title__=None, __description__=None, __tags__={}, __deprecated_msg__=None, data_classification_policy=None, requirements=[], caching=None, apply_to_streams=None, dont_apply_to_streams=None, field=None, to_field=None, field_to_field=None, use_query=None, process_every_value=False, get_default=None, not_exist_ok=False, not_exist_do_nothing=False, serialized_type=<class 'unitxt.types.Table'>), DialogSerializer(__type__='dialog_serializer', __title__=None, __description__=None, __tags__={}, __deprecated_msg__=None, data_classification_policy=None, requirements=[], caching=None, apply_to_streams=None, dont_apply_to_streams=None, field=None, to_field=None, field_to_field=None, use_query=None, process_every_value=False, get_default=None, not_exist_ok=False, not_exist_do_nothing=False, serialized_type=<function NewType.<locals>.new_type at 0x7867c5c59280>)])[source]

Bases: Serializer

class unitxt.serializers.NumberQuantizingSerializer(data_classification_policy: List[str] = None, _requirements_list: Union[List[str], Dict[str, str]] = [], requirements: Union[List[str], Dict[str, str]] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: Union[str, NoneType] = None, to_field: Union[str, NoneType] = None, field_to_field: Union[List[List[str]], Dict[str, str], NoneType] = None, use_query: Union[bool, NoneType] = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False, serialized_type: object = <function NewType.<locals>.new_type at 0x7867c5c35940>, quantum: Union[float, int] = 0.1)[source]

Bases: NumberSerializer

serialized_type()[source]

AbstractField(default: Any = <class ‘unitxt.dataclass.Undefined’>, name: str = None, type: None = None, init: bool = True, also_positional: bool = True, default_factory: Any = None, final: bool = False, abstract: bool = False, required: bool = False, internal: bool = False, origin_cls: None = None, metadata: Dict[str, str] = <factory>)

class unitxt.serializers.NumberSerializer(data_classification_policy: List[str] = None, _requirements_list: Union[List[str], Dict[str, str]] = [], requirements: Union[List[str], Dict[str, str]] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: Union[str, NoneType] = None, to_field: Union[str, NoneType] = None, field_to_field: Union[List[List[str]], Dict[str, str], NoneType] = None, use_query: Union[bool, NoneType] = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False, serialized_type: object = <function NewType.<locals>.new_type at 0x7867c5c35940>)[source]

Bases: SingleTypeSerializer

serialized_type()[source]

AbstractField(default: Any = <class ‘unitxt.dataclass.Undefined’>, name: str = None, type: None = None, init: bool = True, also_positional: bool = True, default_factory: Any = None, final: bool = False, abstract: bool = False, required: bool = False, internal: bool = False, origin_cls: None = None, metadata: Dict[str, str] = <factory>)

class unitxt.serializers.SQLDatabaseAsSchemaSerializer(data_classification_policy: List[str] = None, _requirements_list: Union[List[str], Dict[str, str]] = [], requirements: Union[List[str], Dict[str, str]] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: Union[str, NoneType] = None, to_field: Union[str, NoneType] = None, field_to_field: Union[List[List[str]], Dict[str, str], NoneType] = None, use_query: Union[bool, NoneType] = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False, serialized_type: object = <class 'unitxt.types.SQLDatabase'>)[source]

Bases: SingleTypeSerializer

Serializes a database schema into a string representation.

serialized_type[source]

alias of SQLDatabase

class unitxt.serializers.Serializer(data_classification_policy: List[str] = None, _requirements_list: List[str] | Dict[str, str] = [], requirements: List[str] | Dict[str, str] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: str | NoneType = None, to_field: str | NoneType = None, field_to_field: List[List[str]] | Dict[str, str] | NoneType = None, use_query: bool | NoneType = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False)[source]

Bases: InstanceFieldOperator

class unitxt.serializers.SingleTypeSerializer(data_classification_policy: List[str] = None, _requirements_list: Union[List[str], Dict[str, str]] = [], requirements: Union[List[str], Dict[str, str]] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: Union[str, NoneType] = None, to_field: Union[str, NoneType] = None, field_to_field: Union[List[List[str]], Dict[str, str], NoneType] = None, use_query: Union[bool, NoneType] = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False, serialized_type: object = <class 'unitxt.dataclass.Undefined'>)[source]

Bases: InstanceFieldOperator

class unitxt.serializers.TableSerializer(data_classification_policy: List[str] = None, _requirements_list: Union[List[str], Dict[str, str]] = [], requirements: Union[List[str], Dict[str, str]] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: Union[str, NoneType] = None, to_field: Union[str, NoneType] = None, field_to_field: Union[List[List[str]], Dict[str, str], NoneType] = None, use_query: Union[bool, NoneType] = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False, serialized_type: object = <class 'unitxt.types.Table'>)[source]

Bases: SingleTypeSerializer

serialized_type[source]

alias of Table

class unitxt.serializers.VideoSerializer(data_classification_policy: List[str] = None, _requirements_list: Union[List[str], Dict[str, str]] = [], requirements: Union[List[str], Dict[str, str]] = [], caching: bool = None, apply_to_streams: List[str] = None, dont_apply_to_streams: List[str] = None, field: Union[str, NoneType] = None, to_field: Union[str, NoneType] = None, field_to_field: Union[List[List[str]], Dict[str, str], NoneType] = None, use_query: Union[bool, NoneType] = None, process_every_value: bool = False, get_default: Any = None, not_exist_ok: bool = False, not_exist_do_nothing: bool = False, serialized_type: object = <function NewType.<locals>.new_type at 0x7867c5c59b80>)[source]

Bases: ImageSerializer

serialized_type()[source]

AbstractField(default: Any = <class ‘unitxt.dataclass.Undefined’>, name: str = None, type: None = None, init: bool = True, also_positional: bool = True, default_factory: Any = None, final: bool = False, abstract: bool = False, required: bool = False, internal: bool = False, origin_cls: None = None, metadata: Dict[str, str] = <factory>)