Skip to navigation

aitune.dynamo.protocol

View as Markdown

Dynamo request wiring and response conversion.

Module Contents

Functions

NameDescription
_encode_media_responseValidate and base64-encode a media inference result.
_pack_audio_responsePack a text-to-speech inference result.
_pack_embedding_responsePack an embedding inference result.
_pack_image_responsePack an image inference result.
_pack_video_responsePack a video inference result.
get_register_model_kwargsReturn arguments required by the installed Dynamo version.
get_wiringReturn the Dynamo model input, model type, and request class for a modality.
pack_responseConvert an inference result to the Dynamo wire format.

Data

Modality

SUPPORTED_MODALITIES

_RESPONSE_PACKERS

API

aitune.dynamo.protocol._encode_media_response(
result: typing.Any,
modality: str
) -> str

Validate and base64-encode a media inference result.

aitune.dynamo.protocol._pack_audio_response(
result: typing.Any,
model: str
) -> dict

Pack a text-to-speech inference result.

aitune.dynamo.protocol._pack_embedding_response(
result: typing.Any,
model: str
) -> dict

Pack an embedding inference result.

aitune.dynamo.protocol._pack_image_response(
result: typing.Any,
_model: str
) -> dict

Pack an image inference result.

aitune.dynamo.protocol._pack_video_response(
result: typing.Any,
model: str
) -> dict

Pack a video inference result.

aitune.dynamo.protocol.get_register_model_kwargs() -> dict

Return arguments required by the installed Dynamo version.

aitune.dynamo.protocol.get_wiring(
modality: str
) -> tuple

Return the Dynamo model input, model type, and request class for a modality.

aitune.dynamo.protocol.pack_response(
result: typing.Any,
modality: str,
model: str
) -> dict

Convert an inference result to the Dynamo wire format.

aitune.dynamo.protocol.Modality = Literal['image', 'video', 'audio', 'embedding']
aitune.dynamo.protocol.SUPPORTED_MODALITIES: frozenset[str] = frozenset({'image', 'video', 'audio', 'embedding'})
aitune.dynamo.protocol._RESPONSE_PACKERS: dict[str, Callable[[Any, str], dict]] = {'embedding': _pack_embedding_response, 'image': _pack_image_response, 'video': ...