Skip to content
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

Updated to support gpt-4o #33

Merged
merged 7 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
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"])
toshiakit marked this conversation as resolved.
Show resolved Hide resolved
error("llms:invalidContentTypeForModel", ...
llms.utils.errorMessageCatalog.getMessage("llms:invalidContentTypeForModel", "Image content", this.ModelName));
end
Expand Down
5 changes: 5 additions & 0 deletions tests/topenAIChat.m
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ function createOpenAIChatWithOpenAIKey(testCase)
ApiKey=getenv("OPENAI_KEY"));

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

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

testCase.verifyWarningFree(@()generate(chat, "Hello world."));
toshiakit marked this conversation as resolved.
Show resolved Hide resolved
end

end
Expand Down