Skip to content

Commit

Permalink
Merge pull request #33 from matlab-deep-learning/dev-update-0513models
Browse files Browse the repository at this point in the history
Updated to support gpt-4o
  • Loading branch information
toshiakit committed May 15, 2024
2 parents 9054461 + ea7b486 commit dbd8b70
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The functionality shown here serves as an interface to the ChatGPT and DALL·E A

Some of the current LLMs supported are:
- gpt-3.5-turbo, gpt-3.5-turbo-1106, gpt-3.5-turbo-0125
- gpt-4o, gpt-4o-2024-05-13 (GPT-4 Omni)
- 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
Expand Down
Binary file modified examples/RetrievalAugmentedGenerationUsingChatGPTandMATLAB.mlx
Binary file not shown.
Binary file modified examples/UsingDALLEToEditImages.mlx
Binary file not shown.
5 changes: 3 additions & 2 deletions openAIChat.m
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
arguments
systemPrompt {llms.utils.mustBeTextOrEmpty} = []
nvp.Tools (1,:) {mustBeA(nvp.Tools, "openAIFunction")} = openAIFunction.empty
nvp.ModelName (1,1) {mustBeMember(nvp.ModelName,["gpt-4-turbo", ...
nvp.ModelName (1,1) {mustBeMember(nvp.ModelName,["gpt-4o", ...
"gpt-4o-2024-05-13","gpt-4-turbo", ...
"gpt-4-turbo-2024-04-09","gpt-4","gpt-4-0613", ...
"gpt-3.5-turbo","gpt-3.5-turbo-0125", ...
"gpt-3.5-turbo-1106"])} = "gpt-3.5-turbo"
Expand Down Expand Up @@ -217,7 +218,7 @@
end

if iscell(messagesStruct{end}.content) && any(cellfun(@(x) isfield(x,"image_url"), messagesStruct{end}.content))
if ~ismember(this.ModelName,["gpt-4-turbo","gpt-4-turbo-2024-04-09"])
if ~ismember(this.ModelName,["gpt-4-turbo","gpt-4-turbo-2024-04-09","gpt-4o","gpt-4o-2024-05-13"])
error("llms:invalidContentTypeForModel", ...
llms.utils.errorMessageCatalog.getMessage("llms:invalidContentTypeForModel", "Image content", this.ModelName));
end
Expand Down
7 changes: 7 additions & 0 deletions tests/topenAIChat.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ function createOpenAIChatWithOpenAIKey(testCase)
testCase.verifyWarningFree(@()generate(chat, "Hello world."));
end

function createOpenAIChatWithOpenAIKeyLatestModel(testCase)
chat = openAIChat("You are a useful assistant", ...
ApiKey=getenv("OPENAI_KEY"), ModelName="gpt-4o");

testCase.verifyWarningFree(@()generate(chat, "Hello world."));
end

end
end

Expand Down

0 comments on commit dbd8b70

Please sign in to comment.