Skip to content

Overview

Schema package for modality transformer operations.

This package re-exports the data models used by modality transformers.

Exported schemas

  • TransformResult -- Result of a modality transformation operation.
  • ConverterConfig -- Configuration for a modality converter within a transformer.
  • RouterConfig -- Configuration for the routing layer of a transformer.

ConverterConfig

Bases: BaseModel

Configuration for building a single modality converter instance.

Attributes:

Name Type Description
source_modality Modality

Source modality for conversion. Defaults to Modality.IMAGE.

target_modality Modality

Target modality for conversion. Defaults to Modality.TEXT.

task_type ModalityConverterTask

Converter task type. Defaults to ModalityConverterTask.AUTO.

approach_type ModalityConverterApproach | None

Converter approach type. Defaults to None.

preset str | None

Preset name for the converter. Required for ModalityConverterBuildStrategy.PRESET. Defaults to None.

strategy ModalityConverterBuildStrategy | None

Build strategy for the converter. When None, the strategy is auto-determined from the provided fields (preset → PRESET, lmrp_config → LMRP, otherwise → KWARGS). Defaults to None.

lmrp_config dict[str, Any] | None

Configuration for custom LMRP. Required for ModalityConverterBuildStrategy.LMRP. Follows build_lm_request_processor signature. Defaults to None.

Config

Pydantic model configuration.

This class defines the Pydantic model configuration for the ConverterConfig model.

Attributes:

Name Type Description
extra str

Allow extra fields.

RouterConfig

Bases: BaseModel

Configuration for building a router instance.

Attributes:

Name Type Description
modality Modality

Modality type. Defaults to Modality.IMAGE.

preset ModalityTransformerRouterPreset

Router preset type. Defaults to MULTIMODAL.

model_id str

Embedding model ID for multimodal preset. Defaults to DEFAULT_ROUTER_EMBEDDING_MODEL.

model_params dict[str, Any]

Additional parameters for the embedding model.

es_url str | None

Elasticsearch URL for vector store. Defaults to None.

es_index_name str | None

Elasticsearch index name. Defaults to None.

route_mapping dict[str, str]

Mapping from route labels (as returned by the router) to converter names (keys in converter_config). Defaults to an empty dict.

batch_size int

Batch size for indexing utterances. Defaults to DEFAULT_BATCH_SIZE.

TransformResult

Bases: BaseModel

Base class for all transformation operation results.

This class provides the foundation for structured results from any transformation operation, including: - Image-to-Caption - Image-to-Mermaid

Attributes:

Name Type Description
result str | bytes

The transformed result.

tag str

The tag of the conversion result.

route str

The selected route from the router.

captions str | list[str]

The captions generated during conversion.

text_repr str | list[str] | dict[str, Any]

The text representation of the result.

metadata dict[str, Any] | BaseModel

Additional metadata generated from the transformation.