Description
The ChatGPT Interface Asset (IA) is an off-the-shelf component of Intuiface that enables you to submit prompts to the OpenAI GPT Large Language Model (LLM) (the latest model, GPT-4, is discussed here) and then receive and process the response. This IA uses the OpenAI Chat Completion API, accessing the same LLM used by ChatGPT.
Adding the ChatGPT IA into your experience
The ChatGPT Interface Asset can be added to any experience using the "Add an interface asset" option located within Composer's Interface Assets panel. You will find two options in the OpenAI section:
- If running Player on Windows, use the "ChatGPT - Player on Windows" option. This interface asset was written using .NET, optimizing it for Windows use.
- If running Player anywhere else - from the web to any in-venue platform other than Windows - used the "ChatGPT - Player on all other platforms' option. This interface asset was written using TypeScript, optimizing it for non-Windows, cross-platform use.
These two interface assets work identically. The only difference is under the covers and thus not relevant to your use.
Configuring the ChatGPT IA
To use the ChatGPT Interface Asset, you must assign it an OpenAI API key. An API key is acquired by creating an OpenAI account and then purchasing tokens. (Each GPT prompt and response consumes tokens, and those tokens have a cost.)
Once you have an account and have purchased tokens, head to the OpenAI API Key page to find your key.
This key should be pasted into the "OpenAI API key" property for the ChatGPT Interface Asset:
Creating and sending a prompt
To create and send a prompt, you need to call the "Send prompt" action of the ChatGPT IA. This action has four parameters.
- Prompt
The message sent to the specified GPT model. - Model
The GPT model you'd like to use. This IA defaults to gpt-4, but you can choose from any of OpenAI's currently supported GPT models, including their latest release, gpt-4o. - Temperature
A parameter that controls the “creativity” or randomness of the response generated. It can have any value between 0 and 2. A higher temperature (e.g., 0.7) results in more diverse and creative output, while a lower temperature (e.g., 0.2) makes the output more deterministic and focused. For example, use a high value for creative writing, and a low value for code creation. This IA default to a value of 1. - Maximum Tokens
A limit you can place on the length of the response. See OpenAI's definition of tokens, which can be summarized as "a piece of a word". An OpenAI rule of thumb is that 100 tokens represents about 75 words. This IA defaults to a value of 20 tokens.
Each prompt you send is added to the ongoing conversation you're having with the GPT model - i.e. all previous system guidance and prompts are "remembered". You must call the "Clear chat session" action to start a new conversation.
Sending system guidance
You have the option of sending system guidance to the GPT model before sending a prompt. You can think of system guidance as guidance about the desired context or tone you would like the model to consider when processing a prompt. Different prompts can share the same system guidance.
If you'd like to send system guidance, use the "Specify system guidance" action before using the "Send prompt" action.
- Message
The guidance you are supplying to the model.
Once used, the system guidance will be applied to all prompts until the "Clear chat session" action is called.
Starting a new chat session
Calling the "Clear chat session" action will end the current conversation, removing all system guidance and prompts sent since the last use of this action.
Additional triggers and actions
Triggers
- Response received
Raised when a response has been received following the use of the "Send system guidance" or "Send prompt" actions.
- read-only parameter: Content
This parameter contains the response.
- read-only parameter: Content
- Error message received
Raised when an error is returned instead of a response.
- read-only parameter: Error message
This parameter contains the error message.
- read-only parameter: Error message
Actions
- Set OpenAI API key
Sets the OpenAI API key
Comments
0 comments
Please sign in to leave a comment.