Working with images

All providers (Ollama, Anthropic, and OpenAI) have vision capabilities [1]. As such, regular and assistant chats can work with images through the UI or programmatically.

To attach an image through the UI, simply attach them using the Attach icon at the bottom of the message editor.

In the following, we will exemplify attaching a screenshot of GT programmatically for illustration purposes.

First, we create a chat using the default provider (you can learn how to change it in Managing connections and setting the default).

chat := GtLlmChat new
  

We then create a screenshot of the current window of Glamorous Toolkit.

fileReference := BlExporter png
		scaled: 2;
		element: (GtWorldElement allInstances detect: [:aWorldElement | aWorldElement space isFocused]);
		export
  

Finally, we can send this screenshot to the chat.

chat sendFiles: {fileReference} withMessage: 'What do you see?'
  

[1] Not all models provided by Ollama are equipped with Vision capabilities, but models such as llava or gemma3 come with such capabilities.