def prepare_message_history(prompt, images=None, llm_model=None, tools=None):
    """Prepare message history with prompt and images, adding screenshot for models with computer use capability."""
    message_history = [prompt]
    
    if images:
        for image in images:
            message_history.append(ImageUrl(url=f"data:image/jpeg;base64,{image}"))

    # Add screenshot for models with computer_use capability when ComputerUse tools are requested

    if llm_model and tools and ("ComputerUse.*" in tools or "Screenshot.*" in tools) and has_capability(llm_model, "computer_use"):
        try:
            from .cu import ComputerUse_screenshot_tool_bytes
            result_of_screenshot = ComputerUse_screenshot_tool_bytes()
            message_history.append(BinaryContent(data=result_of_screenshot, media_type='image/png'))
            print(f"Added screenshot for model {llm_model} with computer_use capability")
        except Exception as e:
            print(f"Error adding screenshot for {llm_model}: {e}")
            
    return message_history
Prepare message history with prompt and images, adding screenshot for models with computer use capability.
src/upsonic/server/level_utilized/utility.py