diff --git a/.gitignore b/.gitignore index 9ff7aae..372d991 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ *.asv contents/ChatData.mat contents/GeneratedCode/ +contents/GeneratedImages/ startup.m \ No newline at end of file diff --git a/MatGPT.mlapp b/MatGPT.mlapp index a321ae6..382b98e 100644 Binary files a/MatGPT.mlapp and b/MatGPT.mlapp differ diff --git a/README.md b/README.md index 772840b..3a02cb1 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,15 @@ MatGPT was updated to run on the framework from the '[Large Language Models (LLM * 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 retrieve its web content into the chat. +* 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 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. +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. ## Requirements @@ -54,7 +58,7 @@ To use MatGPT on MATLAB Online, simply click [ view([0 33]) colormap(flip(hot)) shading('interp') -```",gpt-3.5-turbo,1000,0,0 +```",gpt-3.5-turbo,1000,0,0,1,1 Explain Code Step by Step,You are a friendly and helpful teaching assistant for MATLAB programmers. Analyze MATLAB code and explain the code step by step.,"Explain what the following code does. Code by Cecelya Blooming Light in MATLAB Mini Hack 2022 ```matlab @@ -52,7 +53,7 @@ axis( 'equal','off') view([0 33]) colormap(flip(hot)) shading('interp') -```",gpt-3.5-turbo,1000,0,0 +```",gpt-3.5-turbo,1000,0,0,1,1 Script to function,You are a friendly and helpful teaching assistant for MATLAB programmers. Convert MATLAB scripts to a local function and call the function using sample inputs. ,"Convert the following script to a function, using m and T as input variables and set default values to those variables. Code by Cecelya Blooming Light in MATLAB Mini Hack 2022 ```matlab @@ -72,7 +73,7 @@ axis( 'equal','off') view([0 33]) colormap(flip(hot)) shading('interp') -```",gpt-3.5-turbo,1000,0,1 +```",gpt-3.5-turbo,1000,0,1,1,1 Write doc to function,"You are a friendly and helpful teaching assistant for MATLAB programmers. Analyze a MATLAB function and add an elaborate, high quality docstring to the function.","Write useful docstring to this function derived from the code, using comment format %PLOTBLOOMINGLIGHTS does blah blah blah. Code by Cecelya Blooming Light in MATLAB Mini Hack 2022 ```matlab @@ -96,7 +97,7 @@ view([0 33]) colormap(flip(hot)) shading('interp') end -```",gpt-3.5-turbo,1000,0,0 +```",gpt-3.5-turbo,1000,0,0,1,1 Fix Bug,You are a friendly and helpful teaching assistant for MATLAB programmers. Analyze buggy MATLAB code and provide error free code using latest features from R2021a or later. ,"Fix bug in the following MATLAB code ```matlab @@ -108,14 +109,14 @@ y = ""a"" + b end ``` -% Fixed MATLAB code",gpt-3.5-turbo,1000,0,0 +% Fixed MATLAB code",gpt-3.5-turbo,1000,0,0,1,1 Write Unit Tests,You are a friendly and helpful teaching assistant for MATLAB programmers. Analyze MATLAB functions and write appropriate unit tests.,"Write unit tests for this function, ```matlab function y = add(a, b) y = a + b end -```",gpt-3.5-turbo,1000,0,0 +```",gpt-3.5-turbo,1000,0,0,1,1 Vectorize Code,You are a friendly and helpful teaching assistant for MATLAB programmers. Analyze MATLAB code and rewrite it to improve efficiency using vectorization rather than for loops.,"Vectorize the following code without using for loop. ```matlab @@ -124,12 +125,12 @@ for t = 0:.01:10 i = i + 1; y(i) = sin(t); end -```",gpt-3.5-turbo,1000,0,1 +```",gpt-3.5-turbo,1000,0,1,1,1 Act as MATLAB Command Window,"You are a MATLAB interpreter. I will give you MATLAB code, you'll reply with what the Command Window should show. Do not provide any explanations. Do not respond with anything except the output of the code. ","```matlab x = (1:10)*2 ``` -",gpt-3.5-turbo,1000,0,0 +",gpt-3.5-turbo,1000,0,0,1,1 Sentiment Analysis,You are a helpful assistant that helps data scientists by analyzing sentiment expressed in a given text.,"Decide whether sentiment is positive, neutral, or negative for the following text 1. ""I can't stand homework"" @@ -138,7 +139,7 @@ Sentiment Analysis,You are a helpful assistant that helps data scientists by ana 4. ""My cat is adorable ❤️❤️"" 5. ""I hate chocolate"" -Text sentiment ratings:",gpt-3.5-turbo,1000,0,0 +Text sentiment ratings:",gpt-3.5-turbo,1000,0,0,1,1 Contact Extraction,You are a helpful assistant that helps data scientists by analyzing unstructured data and extract personally identifiable information.,"Extract the name and mailing address from this text: Dear Kelly, @@ -150,7 +151,7 @@ Thank you for the book. Here's my address Best, -Maya",gpt-3.5-turbo,1000,0,0 +Maya",gpt-3.5-turbo,1000,0,0,1,1 Extract table from PDF,You are a helpful assistant that helps data scientists by analyzing unstructured data and recreate a table from the text extracted from a PDF file.,"format the following PDF data into a table. Start with a title, then the table and end with a footer citing the source. A(Percentage)verage annual export growth rates of creative goods, 2006−2020 @@ -218,20 +219,20 @@ A(Percentage)verage annual export growth rates of creative goods, 2006−2020 -7.2 - ",gpt-3.5-turbo,1000,0,0 -Top 10 SciFi movies,You are a helpful assistant that helps data scientists extract useful public data for analysis.,"Create a table of top 10 science fiction movies, their year of release, and box office gross. Name columns 'Title', 'Year', and 'Gross'.",gpt-3.5-turbo,1000,0,0 + ",gpt-3.5-turbo,1000,0,0,1,1 +Top 10 SciFi movies,You are a helpful assistant that helps data scientists extract useful public data for analysis.,"Create a table of top 10 science fiction movies, their year of release, and box office gross. Name columns 'Title', 'Year', and 'Gross'.",gpt-3.5-turbo,1000,0,0,1,1 San Francisco Weather,You are a helpful assistant that helps data scientists extract useful public data for analysis.,"Create a table of weather temperatures for San Francisco. Name columns 'Month', 'High', and 'Low'. -Use abbreviated month names. Use numbers only for temperature using Fahrenheit.",gpt-3.5-turbo,1000,0,0 +Use abbreviated month names. Use numbers only for temperature using Fahrenheit.",gpt-3.5-turbo,1000,0,0,1,1 Boston Housing Prices,You are a helpful assistant that helps data scientists extract useful public data for analysis.,"Housing prices are correlated with size of the house. Create a table of housing prices in Boston based on square footage as size with columns named 'Sqft' and 'Price' with 10 rows. Randomize the values in 'Sqft', -while maintaining the correlation to 'Price' with some variation.",gpt-3.5-turbo,1000,0,0 +while maintaining the correlation to 'Price' with some variation.",gpt-3.5-turbo,1000,0,0,1,1 Boston Landmarks,You are a helpful assistant that helps data scientists extract useful public data for analysis.,"Create a markdown table of famous landmarks in Boston with latitude and longitude in decimal degrees, i.e. 42.361145, -71.057083 Generate MATLAB Code that stores the data in variables landmarks, lat and lon. Use geoscatter function to plot the data points. Annotate the data points with the names of the landmarks using text function. - Avoid using for loop.",gpt-3.5-turbo,1000,0,0 + Avoid using for loop.",gpt-3.5-turbo,1000,0,0,1,1 Remove duplicate names,You are a helpful assistant that helps data scientists extract useful public data for analysis.,"Here is a list of names. John Smith @@ -248,7 +249,7 @@ Brown Jennifer Create a table with two columns from this list that split the first name and last name. If first name appears as last name, correct the order. -remove any duplicates. Show the table in markdown format.",gpt-3.5-turbo,1000,0,0 +remove any duplicates. Show the table in markdown format.",gpt-3.5-turbo,1000,0,0,1,1 Email Domains to Company Names,You are a helpful assistant that helps data scientists extract useful public data for analysis.,"Identify legal company names based on the following domains 1. @apple.com @@ -264,7 +265,7 @@ Email Domains to Company Names,You are a helpful assistant that helps data scien 11. @mcdonalds.com 12. @chevron.com1 13. @unitedparcelservice.com -14. @dell.com",gpt-3.5-turbo,1000,0,0 +14. @dell.com",gpt-3.5-turbo,1000,0,0,1,1 Normalize University Names,You are a helpful assistant that helps data scientists extract useful public data for analysis.,"Normalize the list of university names below. If a university has multiple names, apply the most common full name, not an abbreviation. CMU @@ -288,4 +289,4 @@ Georgiatech MIT Massachusetts Institute of Technology -",gpt-3.5-turbo,1000,0,0 +",gpt-3.5-turbo,1000,0,0,1,1 diff --git a/helpers/MsgHelper.m b/helpers/MsgHelper.m index cb0e9ab..68821ab 100644 --- a/helpers/MsgHelper.m +++ b/helpers/MsgHelper.m @@ -16,7 +16,8 @@ struct('name','gpt-4-0613','attributes',struct('contextwindow',8192,'cutoff','Sep 2021'),'legacy',false), ... struct('name','gpt-4-1106-preview','attributes',struct('contextwindow',128000,'cutoff','Apr 2023'),'legacy',false), ... struct('name','gpt-4-vision-preview','attributes',struct('contextwindow',128000,'cutoff','Apr 2023'),'legacy',false), ... - struct('name','gpt-4-turbo-preview','attributes',struct('contextwindow',128000,'cutoff','Apr 2023'),'legacy',false) ... + struct('name','gpt-4-turbo-preview','attributes',struct('contextwindow',128000,'cutoff','Apr 2023'),'legacy',false), ... + struct('name','dall-e-3','attributes',struct('contextwindow','n/a','cutoff','n/a'),'legacy',false), ... ]; contextwindow = models(arrayfun(@(x) string(x.name), models) == modelName).attributes.contextwindow; cutoff = models(arrayfun(@(x) string(x.name), models) == modelName).attributes.cutoff; @@ -37,7 +38,8 @@ "