Parameter Modality Resolver
Utility class for determining the high-level DataModality associated with a parameter’s declared encoding. This resolver maps common encoding names (e.g., "mp3", "png", "utf-8") to modality categories such as Audio, Image, Text, and Video. The resolver is used within the Norman SDK to validate parameter metadata and decide how inputs should be interpreted or transformed before being sent to a model.
Methods
resolve(encoding) staticmethod
Resolve the given encoding string into its corresponding DataModality.
The lookup is case-insensitive and trims leading/trailing whitespace. If the encoding is not part of the predefined _Encoding_Map, the resolver raises an error.
Parameters
encoding (
str) A non-empty encoding string such as"mp3","png","utf-8", or"h264". The value is normalized to lowercase before lookup.
Returns
DataModality The modality associated with the provided encoding, such as
DataModality.Audio,DataModality.Image, etc.
Raises
ValueError Raised if:
The encoding is
NoneThe encoding is not a string
The encoding is not recognized or supported