Working with the OpenAI API client
The API client offers the direct connection to the OpenAI API. Before you can work with it, please first see about Adding an OpenAI API key.
If you stored your API in a file instantiate the client like this:
client := GtOpenAIClient withApiKeyFromFile
This is the default mechanism.
If you have the API in the clipboard, you can instead do this:
client := GtOpenAIClient withApiKeyFromClipboard
This client is your entry point for interacting with OpenAI. You can for instance use it to query the list of models.
client listModels
You can even use it to interact with the chat feature directly.
messages := { GtLlmSystemMessage new content: 'You are a helpful assistant.'. GtLlmUserMessage new content: 'Hello ChatGPT! How are you today?' }. client completeChatWithModel: 'gpt-3.5-turbo' andMessages: messages