Handling custom instructions using assistants
Assistants 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 instructions and context than a single chat can provide.
assistant := GtLlmAssistant new
By default, the assistant’s instructions are quite bare bones. They can be adjusted in any way, for example by giving it a more tailored description of itself.
assistant 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.'
Once the assistant has been set up, it is ready to be chatted with.
assistant createChat
By default, assistants use your default as a provider. This can be changed programmatically or through the chat UI. Please note that not all providers support assistants equally. See also the notes in Adding custom tools to assistants.
To allow for better programmatic control, assistants are "action-based". This means that messages to and from the LLM follow a schema of actions and responses. By default, an assistant only has a chat action, but new actions can be added a priori or on the fly.
assistant addAction: (GtLlmAssistantAction new name: 'Calculate'; priority: 10; description: 'Calculate the given expression.'; addArgument: 'Expression')
After executing the snippet above, you will have access to the new action in the chat above.
For more information on assistants, refer to the Building an LLM assistant for editing blog posts case study.