MatGPT
MatGPT is a MATLAB app that allows you to easily access OpenAI's ChatGPT API. With the app, you can load a list of prompts for specific use cases and engage in conversations with ease. If you're new to ChatGPT and prompt engineering, MatGPT is a great way to learn.
The app simply serves as an interface to the ChatGPT API. You should be familiar with the limitations and risks associated with using this technology as well as with OpenAI terms and policies. You are responsible for any fees OpenAI may charge for the use of their API.
MatGPT was updated to run on the framework from the 'Large Language Models (LLMs) with MATLAB' repo maintained by MathWorks.
MATLAB AI Chat Playground is a great alternative to MatGPT on MATLAB Central.
- MatGPT runs on the 'LLMs with MATLAB' framework, which requires MATLAB R2023a or later.
- MatGPT supports streaming API where response tokens are displayed as they come in.
- MatGPT detects a URL included in a prompt, and retrieves its web content into the chat.
- MatGPT lets you import a .m, .mlx, .csv or .txt file into the chat. PDF files are also supported if Text Analytics Toolbox is available.
- MatGPT supports GPT-4 Turbo with Vision. You can pass the URL to an image, or a local image file path ask questions about the image.
- MatGPT lets you generate an image via DALL·E 3.
Please note that:
- imported content will be truncated if it exceeds the context window limit.
- Streaming must be disabled to use image generation via DALL·E 3.
- MathWorks Products (https://www.mathworks.com): Use MatGPT to run on MATLAB Online that comes with the most commonly used toolboxes. To use it on desktop, you must have MATLAB R2023a or later installed on your computer.
- OpenAI API Key: Additionally, you will need your own API key from https://platform.openai.com/account/api-keys. If you don’t want to set up an API access with OpenAI, MATLAB AI Chat Playground is a better option.
- GPT-4 models are available to all API users who have a history of successful payments. If you have not made any payment to OpenAI, the GPT-4 models are not accessible.
To use MatGPT on MATLAB Online, simply click
- Download the content of this repository into a MATLAB path.
- Launch MATLAB
- type 'MatGPT' in the command window
- Click on
+ New Chat
in the left nav to add a new chat. This opens theSettings
tab. - In the
Settings
tab, either choose a preset to populate the settings or customize on your own. Once you have completed the settings, clickStart New Chat
to initiate a chat. This will take you back to theMain
tab.
- Presets are loaded from Presets.csv - feel free to customize your prompts.
- In the
Main
tab, a sample prompt is already provided based on the preset you selected, but feel free to replace it with your own. When you clickSend
button, the response will be shown in the 'Chat' tab.
- The paperclip button lets you include the content of a m-file, live script file or csv file in the chat.
- If the prompt contains a URL, MatGPT ask you to confirm that you want to open the page.
- The
Send
button and Paperclip button are disabled until a chat is configured in theSettings
tab. - If you want suggestion for follow-up questions in the response, check
Suggest follow-up questions
checkbox. Suggested questions appear as clickable buttons. You can copy a suggested question to the prompt box by clicking it. - If your prompt is intended to generate MATLAB code, check
Test Generated MATLAB Code
checkbox to test the returned code. - The
Usage
tab shows the number of tokens used in the current chat session. - Add stop sequences in
Advanced
tab to specify the sequences where the API will stop generating further tokens.
- Continue the conversation by keep adding more prompts and clicking
Send
. - You can right-click or double-click a chat in the left navigation panel to rename, delete, or save the chat to a text file.
- When you close the app, the chat will be saved and will be reloaded into the left nav when you relaunch the app.
- You can increase the connection timeout in the
Settings
. You can add proxy via Web Preferences in MATLAB. - Streaming is enabled by default, but you can turn it off in the
Settings
tab. Usage data is not available in streaming mode.
chatGPT class was replaced by the framework provided via the 'Large Language Models (LLMs) with MATLAB' repo. The new framework supports function calling and other latest features. Please refer to the documentation in the repo to learn how to use it.
This code is adapted from this MATLAB Answers comment by Hans Scharler and uses Brian Buechel's CodeChecker and other great contributions. The video shown above was created by Angel Gonzalez Llacer.
The license for MatGPT is available in the LICENSE.txt file in this GitHub repository.
Cite As
Toshiaki Takeuchi (2024). MatGPT (https://github.com/toshiakit/MatGPT/releases/tag/2.0.2), GitHub. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
helpers
helpers/llms-with-matlab
helpers/llms-with-matlab/+llms/+internal
helpers/llms-with-matlab/+llms/+stream
helpers/llms-with-matlab/+llms/+utils
helpers/llms-with-matlab/examples
Version | Published | Release Notes | |
---|---|---|---|
2.0.2 | See release notes for this release on GitHub: https://github.com/toshiakit/MatGPT/releases/tag/2.0.2 |
||
2.0.1 | See release notes for this release on GitHub: https://github.com/toshiakit/MatGPT/releases/tag/2.0.1 |
||
2.0.0 | See release notes for this release on GitHub: https://github.com/toshiakit/MatGPT/releases/tag/2.0.0 |
||
1.3.1.0 | See release notes for this release on GitHub: https://github.com/toshiakit/MatGPT/releases/tag/1.3.1 |
||
1.3.0.0 | See release notes for this release on GitHub: https://github.com/toshiakit/MatGPT/releases/tag/1.3.0 |
||
1.2.1.1 | See release notes for this release on GitHub: https://github.com/toshiakit/MatGPT/releases/tag/1.2.1.1 |
||
1.2.1.0 | See release notes for this release on GitHub: https://github.com/toshiakit/MatGPT/releases/tag/1.2.1 |
||
1.2.0.0 | See release notes for this release on GitHub: https://github.com/toshiakit/MatGPT/releases/tag/1.2.0 |
||
1.1.0.0 | See release notes for this release on GitHub: https://github.com/toshiakit/MatGPT/releases/tag/1.1.0 |
||
1.0.0 |