motleycrew.utils.image_utils

Utilities for working with images in LLM contexts.

Functions

human_message_from_image_bytes(image_bytes, ...)

image_file_to_bytes_and_mime_type(image_path)

Create a HumanMessage containing an image represented as bytes

is_this_a_chart(image_bytes, mime_type, llm)

motleycrew.utils.image_utils.human_message_from_image_bytes(image_bytes: bytes, mime_type: str) HumanMessage
motleycrew.utils.image_utils.image_file_to_bytes_and_mime_type(image_path: str) Tuple[bytes, str]

Create a HumanMessage containing an image represented as bytes

Parameters:

image_path – Path to the local image file

Returns:

HumanMessage containing the image content

motleycrew.utils.image_utils.is_this_a_chart(image_bytes: bytes, mime_type: str, llm: BaseLanguageModel) bool