Basic chatting
The basic interface for working with an LLM is zthe GtLChat
. It allows the user to interact with an LLM programmatically or through a UI. The backend of these chats is abstracted and can be changed.
You can begin a chat using the default connection if it is set up. See how to check this and change the default connection in Managing LLM provider connections and setting the default.
chat := GtLChat new
You can also connect to a specific provider. To chat with OpenAI, for instance, ensure that you have added an API key. This can be done in Adding an OpenAI API key. After the API key was added, you will be able to chat with an LLM.
chat := GtLChat new provider: GtLOpenAIProvider withApiKeyFromFile
Executing the snippet above will allow you to interact with the chat through a UI. You can also send messages through code.
chat sendMarkdown: 'Hello'