def _from_azure_thread_message(self, thread_message: object) -> ChatMessage:
        """
        Convert an Azure/OpenAI thread message to a LlamaIndex ChatMessage.
        Supports text and image_url content blocks for multimodal support.
        """
        from llama_index.core.base.llms.types import ChatMessage, TextBlock, ImageBlock

        blocks = []
        for t in getattr(thread_message, "content", []):
            t_type = getattr(t, "type", None)
            if t_type == "text":
                text_val = getattr(getattr(t, "text", None), "value", "")
                blocks.append(TextBlock(text=text_val))
            elif t_type == "image_url":
                url_val = getattr(getattr(t, "image_url", None), "url", None)
                detail_val = getattr(getattr(t, "image_url", None), "detail", None)
                if url_val:
                    blocks.append(ImageBlock(url=url_val, detail=detail_val))
        # Compose content string for backward compatibility (concatenate text blocks)
        content_str = " ".join([b.text for b in blocks if hasattr(b, "text")])
        return ChatMessage(
            role=getattr(thread_message, "role", ""),
            content=content_str,
            blocks=blocks,
            additional_kwargs={
                "thread_message": thread_message,
                "thread_id": getattr(thread_message, "thread_id", None),
                "assistant_id": getattr(thread_message, "assistant_id", None),
                "id": getattr(thread_message, "id", None),
                "metadata": getattr(thread_message, "metadata", None),
            },
        )

        Convert an Azure/OpenAI thread message to a LlamaIndex ChatMessage.
        Supports text and image_url content blocks for multimodal support.
        
llama-index-integrations/agent/llama-index-agent-azure/llama_index/agent/azure_foundry_agent/base.py