Handling custom instructions using tutors

Tutors are an abstraction in Glamorous Toolkit that allow for custom prompts and more agent-like behavior. They are meant to be used for more complex tasks requiring imore nstructions and context than a single chat can provide.

tutor := GtLlmTutor new
  

By default, the tutor’s instructions are quite bare bones. They can be adjusted in any way, for example by giving it a more tailored description of itself.

tutor description: 'You are a helpful assistant that runs from within Glamorous Toolkit, a development environment. You in particular are meant to be a demonstration of what an assistant in Glamorous Toolkit could look like. You should mention that you are part of the Glamorous Toolkit environment from the start.'
  

By default, tutors use OpenAI as a provider. This can be changed by either changing the provider outright, or using the convenience method to change to a particular Olllama model.

tutor onOllamaWithModel: 'llama3.1'
  

Once the tutor has been set up, it is ready to be chatted with.

tutor createChat
  

To allow for better programmatic control, tutors are "action-based". This means that messages to and from the LLM follow a schema of actions and responses. By default. a tutor only has a chat action, but new actions can be added a priori or on the fly.

tutor addAction: (GtLlmTutorAction new
	    name: 'Calculate';
	    priority: 10;
		description: 'Calculate the given expression.';
		format: 'Calulate: {1}')
  

After executing the snippet above, you will have access to the new action in the chat above.

For more information on tutors, refer to the Building an LLM assistant for editing blog posts and Building an LLM assistant for creating Wardley Maps case studies.