Home

Awesome

MatGPT - MATLAB® app to access ChatGPT API from OpenAI™

View MatGPT on File Exchange Open in MATLAB Online

MatGPT Logo

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 requires 'Large Language Models (LLMs) with MATLAB' library maintained by MathWorks.

MATLAB AI Chat Playground is a great alternative to MatGPT on MATLAB Central.

What's New

Please note that:

Requirements

Installation

MATLAB Online

To use MatGPT on MATLAB Online, simply click Open in MATLAB Online MATLAB Online pulls the content of this repo, including "LLMS with MATLAB" submodule.

Please note that "Open in MATLAB Online" button on the File Exchange doesn't pull the submodule. You will need to pull LLMs with MATLAB separately and add it to the 'LLMs with MATLAB' folder in the helpers folder.

MATLAB Desktop

Use Git commands to clone the repo to your local directory, and then clone the submodules. This will ensure you get the 'LLMs with MATLAB' library.

git clone https://github.com/toshiakit/MatGPT.git
git submodule update --init

If you download MatGPT as a Zip file, the zip file will not contain the submodule. You need to download 'LLMs with MATLAB' separately and unzip into the 'LLMs with MATLAB' folder in the helpers folder.

How to use: MatGPT app

MatGPT Chat Tab

  1. Click on + New Chat in the left nav to add a new chat. This opens the Settings tab.
  2. In the Settings tab, either choose a preset to populate the settings or customize on your own. Once you have completed the settings, click Start New Chat to initiate a chat. This will take you back to the Main tab.
  1. 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 click Send button, the response will be shown in the 'Chat' tab.
  1. Continue the conversation by keep adding more prompts and clicking Send.
  2. 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.
  3. When you close the app, the chat will be saved and will be reloaded into the left nav when you relaunch the app.

Note:

What happened to chatGPT class?

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.

Acknowledgements

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.

License

The license for MatGPT is available in the LICENSE.txt file in this GitHub repository.