-
Notifications
You must be signed in to change notification settings - Fork 36
Reflecting the updated models released on April 9, 2024 #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
eeaf9c2
9fe8a06
89e20a2
03cb841
9010081
1e626d9
4d54d08
d741c6a
b0ad463
a6ba4e4
f9124a1
40a3e49
83a75fc
dde7c0e
c78d0f9
55b421f
e9acd81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,8 +49,10 @@ | |
catalog("llms:mustBeMessagesOrTxt") = "Messages must be text with one or more characters or an openAIMessages objects."; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Messages must be nonempty char, string, or openAIMessages object. |
||
catalog("llms:invalidOptionAndValueForModel") = "'{1}' with value '{2}' is not supported for ModelName '{3}'"; | ||
catalog("llms:invalidOptionForModel") = "{1} is not supported for ModelName '{2}'"; | ||
catalog("llms:invalidContentTypeForModel") = "{1} is not supported for ModelName '{2}'"; | ||
catalog("llms:functionNotAvailableForModel") = "This function is not supported for ModelName '{1}'"; | ||
catalog("llms:promptLimitCharacter") = "Prompt must have a maximum length of {1} characters for ModelName '{2}'"; | ||
catalog("llms:pngExpected") = "Argument must be a PNG image."; | ||
catalog("llms:warningJsonInstruction") = "When using JSON mode, you must also prompt the model to produce JSON yourself via a system or user message."; | ||
catalog("llms:apiReturnedError") = "OpenAI API Error: {1}"; | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,11 @@ This repository contains example code to demonstrate how to connect MATLAB to th | |
The functionality shown here serves as an interface to the ChatGPT and DALL·E APIs. To start using the OpenAI APIs, you first need to obtain OpenAI API keys. You are responsible for any fees OpenAI may charge for the use of their APIs. You should be familiar with the limitations and risks associated with using this technology, and you agree that you shall be solely responsible for full compliance with any terms that may apply to your use of the OpenAI APIs. | ||
|
||
Some of the current LLMs supported are: | ||
- gpt-3.5-turbo, gpt-3.5-turbo-1106 | ||
- gpt-4, gpt-4-1106-preview | ||
- gpt-4-vision-preview (a.k.a. GPT-4 Turbo with Vision) | ||
- gpt-3.5-turbo, gpt-3.5-turbo-1106, gpt-3.5-turbo-0125 | ||
- gpt-4-turbo, gpt-4-turbo-2024-04-09 (GPT-4 Turbo with Vision) | ||
- gpt-4, gpt-4-0613 | ||
- dall-e-2, dall-e-3 | ||
|
||
For details on the specification of each model, check the official [OpenAI documentation](https://platform.openai.com/docs/models). | ||
|
||
## Requirements | ||
|
@@ -52,15 +52,15 @@ To use this repository with a local installation of MATLAB, first clone the repo | |
|
||
Set up your OpenAI API key. Create a `.env` file in the project root directory with the following content. | ||
|
||
``` | ||
OPENAI_API_KEY=<your key> | ||
``` | ||
``` | ||
OPENAI_API_KEY=<your key> | ||
``` | ||
|
||
Then load your `.env` file as follows: | ||
Then load your `.env` file as follows: | ||
|
||
```matlab | ||
loadenv(".env") | ||
``` | ||
```matlab | ||
loadenv(".env") | ||
``` | ||
|
||
## Getting Started with Chat Completion API | ||
|
||
|
@@ -287,13 +287,13 @@ You can extract the arguments and write the data to a table, for example. | |
|
||
### Understand the content of an image | ||
|
||
You can use gpt-4-vision-preview to experiment with image understanding. | ||
You can use gpt-4-turbo to experiment with image understanding. | ||
```matlab | ||
chat = openAIChat("You are an AI assistant.", ModelName="gpt-4-vision-preview"); | ||
chat = openAIChat("You are an AI assistant.", ModelName="gpt-4-turbo"); | ||
image_path = "peppers.png"; | ||
messages = openAIMessages; | ||
messages = addUserMessageWithImages(messages,"What is in the image?",image_path); | ||
[txt,response] = generate(chat,messages); | ||
[txt,response] = generate(chat,messages,MaxNumTokens=4096); | ||
% Should output the description of the image | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Returns image description |
||
``` | ||
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "in" should be upper case, i.e. AnalyzeSentimentInTextUsingChatGPTInJSONMode.mlx |
Uh oh!
There was an error while loading. Please reload this page.