def from_inference_message(message: ChatResponseMessage) -> ChatMessage:
    """Convert an inference message dict to generic message."""
    role = message.role
    content = message.as_dict().get("content", "")

    # function_call = None  # deprecated in OpenAI v 1.1.0

    additional_kwargs: Dict[str, Any] = {}
    if message.tool_calls is not None:
        tool_calls: List[ChatCompletionsToolCall] = message.tool_calls
        additional_kwargs.update(tool_calls=tool_calls)

    return ChatMessage(role=role, content=content, additional_kwargs=additional_kwargs)
Convert an inference message dict to generic message.
llama-index-integrations/llms/llama-index-llms-azure-inference/llama_index/llms/azure_inference/base.py