#!/usr/bin/env python3
import lmstudio as lms

# requires a multi modal model with vision support
model  = lms.llm("mistralai/devstral-small-2-2512")

# create the chat, add the user message with image
chat = lms.Chat("You are an expert for image analysis.")
i_handle = lms.prepare_image("sample.jpg")
prompt = """Describe this image in detail. Try to 
            guess where the photo has been taken."""
chat.add_user_message(prompt, images=[i_handle])

for fragment in model.respond_stream(chat):
    print(fragment.content, end="", flush=True)
