Skip to content

Multimodal em invoker

Defines a base class for multimodal embedding model invokers used in Gen AI applications.

Authors

Henry Wicaksono (henry.wicaksono@gdplabs.id)

References

NONE

BaseMultimodalEMInvoker

Bases: ABC, Generic[InputType]

A base class for multimodal embedding model invokers used in Gen AI applications.

The BaseMultimodalEMInvoker class provides a framework for invoking multimodal embedding models. The input may contain multimodal content that is defined by the type variable InputType.

invoke(content) async

Invokes the multimodal embedding model with the provided content.

This method validates the content and then invokes the multimodal embedding model by calling the _invoke method.

Parameters:

Name Type Description Default
content InputType | list[InputType]

The input content or list of input contents to be embedded using the multimodal embedding model. The content may contain multimodal inputs that is defined by the type variable InputType.

required

Returns:

Type Description
Vector | list[Vector]

Vector | list[Vector]: The vector representations of the input content: 1. If the input is a single content, the output is a Vector. 2. If the input is a list of contents, the output is a list[Vector].

Raises:

Type Description
ValueError

If the content is not of the correct type.