Skip to content

Overview

Image modality transformer implementations.

This package provides transformers that convert image inputs into text outputs using either a single converter or a routed multi-converter approach.

Submodules

Exported Classes

GenericImageModalityTransformer(converter)

Bases: ImageModalityTransformer

A generic transformer which uses a single converter to convert images to text.

Attributes:

Name Type Description
converter BaseModalityConverter

The converter used to transform images into text.

Initializes the transformer with a modality converter.

Parameters:

Name Type Description Default
converter BaseModalityConverter

An instance of a modality converter responsible for performing the image-to-text or image-to-bytes transformation.

required

from_config(converter_config=None) classmethod

Create an instance from a converter configuration dict.

This function
  1. Build the converter from the converter_config.
  2. Create the GenericImageModalityTransformer instance.

Parameters:

Name Type Description Default
converter_config dict[str, ConverterConfig] | None

Per-converter configurations keyed by converter name. Defaults to None.

None

Returns:

Name Type Description
GenericImageModalityTransformer GenericImageModalityTransformer

An instance configured from the given dict.