Skip to content

Commit dbd8b70

Browse files
authored
Merge pull request #33 from matlab-deep-learning/dev-update-0513models
Updated to support gpt-4o
2 parents 9054461 + ea7b486 commit dbd8b70

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The functionality shown here serves as an interface to the ChatGPT and DALL·E A
88

99
Some of the current LLMs supported are:
1010
- gpt-3.5-turbo, gpt-3.5-turbo-1106, gpt-3.5-turbo-0125
11+
- gpt-4o, gpt-4o-2024-05-13 (GPT-4 Omni)
1112
- gpt-4-turbo, gpt-4-turbo-2024-04-09 (GPT-4 Turbo with Vision)
1213
- gpt-4, gpt-4-0613
1314
- dall-e-2, dall-e-3
Binary file not shown.

examples/UsingDALLEToEditImages.mlx

0 Bytes
Binary file not shown.

openAIChat.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@
114114
arguments
115115
systemPrompt {llms.utils.mustBeTextOrEmpty} = []
116116
nvp.Tools (1,:) {mustBeA(nvp.Tools, "openAIFunction")} = openAIFunction.empty
117-
nvp.ModelName (1,1) {mustBeMember(nvp.ModelName,["gpt-4-turbo", ...
117+
nvp.ModelName (1,1) {mustBeMember(nvp.ModelName,["gpt-4o", ...
118+
"gpt-4o-2024-05-13","gpt-4-turbo", ...
118119
"gpt-4-turbo-2024-04-09","gpt-4","gpt-4-0613", ...
119120
"gpt-3.5-turbo","gpt-3.5-turbo-0125", ...
120121
"gpt-3.5-turbo-1106"])} = "gpt-3.5-turbo"
@@ -217,7 +218,7 @@
217218
end
218219

219220
if iscell(messagesStruct{end}.content) && any(cellfun(@(x) isfield(x,"image_url"), messagesStruct{end}.content))
220-
if ~ismember(this.ModelName,["gpt-4-turbo","gpt-4-turbo-2024-04-09"])
221+
if ~ismember(this.ModelName,["gpt-4-turbo","gpt-4-turbo-2024-04-09","gpt-4o","gpt-4o-2024-05-13"])
221222
error("llms:invalidContentTypeForModel", ...
222223
llms.utils.errorMessageCatalog.getMessage("llms:invalidContentTypeForModel", "Image content", this.ModelName));
223224
end

tests/topenAIChat.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ function createOpenAIChatWithOpenAIKey(testCase)
161161
testCase.verifyWarningFree(@()generate(chat, "Hello world."));
162162
end
163163

164+
function createOpenAIChatWithOpenAIKeyLatestModel(testCase)
165+
chat = openAIChat("You are a useful assistant", ...
166+
ApiKey=getenv("OPENAI_KEY"), ModelName="gpt-4o");
167+
168+
testCase.verifyWarningFree(@()generate(chat, "Hello world."));
169+
end
170+
164171
end
165172
end
166173

0 commit comments

Comments
 (0)