convert_to_openai_image_block#

langchain_core.messages.content_blocks.convert_to_openai_image_block(
content_block: dict[str, Any],
) β†’ dict[source]#

Convert image content block to format expected by OpenAI Chat Completions API.

Parameters:

content_block (dict[str, Any]) – The content block to convert.

Raises:

ValueError – If the source type is not supported or if mime_type is missing for base64 data.

Returns:

A dictionary formatted for OpenAI’s API.

Return type:

dict