Skip to content

Commit

Permalink
Eliminated validation related to removed models
Browse files Browse the repository at this point in the history
  • Loading branch information
toshiakit committed Apr 13, 2024
1 parent 03cb841 commit 9010081
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions openAIChat.m
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@

if isfield(nvp,"StreamFun")
this.StreamFun = nvp.StreamFun;
if strcmp(nvp.ModelName,'gpt-4-vision-preview')
error("llms:invalidOptionForModel", ...
llms.utils.errorMessageCatalog.getMessage("llms:invalidOptionForModel", "StreamFun", nvp.ModelName));
end
else
this.StreamFun = [];
end
Expand All @@ -146,10 +142,6 @@
else
this.Tools = nvp.Tools;
[this.FunctionsStruct, this.FunctionNames] = functionAsStruct(nvp.Tools);
if strcmp(nvp.ModelName,'gpt-4-vision-preview')
error("llms:invalidOptionForModel", ...
llms.utils.errorMessageCatalog.getMessage("llms:invalidOptionForModel", "Tools", nvp.ModelName));
end
end

if ~isempty(systemPrompt)
Expand All @@ -163,20 +155,15 @@
this.Temperature = nvp.Temperature;
this.TopProbabilityMass = nvp.TopProbabilityMass;
this.StopSequences = nvp.StopSequences;
if ~isempty(nvp.StopSequences) && strcmp(nvp.ModelName,'gpt-4-vision-preview')
error("llms:invalidOptionForModel", ...
llms.utils.errorMessageCatalog.getMessage("llms:invalidOptionForModel", "StopSequences", nvp.ModelName));
end


% ResponseFormat is only supported in the latest models only
if (nvp.ResponseFormat == "json")
if ismember(this.ModelName,["gpt-3.5-turbo-1106","gpt-4-1106-preview"])
warning("llms:warningJsonInstruction", ...
llms.utils.errorMessageCatalog.getMessage("llms:warningJsonInstruction"))
else
if ismember(this.ModelName,["gpt-4","gpt-4-0613"])
error("llms:invalidOptionAndValueForModel", ...
llms.utils.errorMessageCatalog.getMessage("llms:invalidOptionAndValueForModel", "ResponseFormat", "json", this.ModelName));
else
warning("llms:warningJsonInstruction", ...
llms.utils.errorMessageCatalog.getMessage("llms:warningJsonInstruction"))
end

end
Expand Down Expand Up @@ -222,10 +209,6 @@
end

toolChoice = convertToolChoice(this, nvp.ToolChoice);
if ~isempty(nvp.ToolChoice) && strcmp(this.ModelName,'gpt-4-vision-preview')
error("llms:invalidOptionForModel", ...
llms.utils.errorMessageCatalog.getMessage("llms:invalidOptionForModel", "ToolChoice", this.ModelName));
end

if isstring(messages) && isscalar(messages)
messagesStruct = {struct("role", "user", "content", messages)};
Expand Down

0 comments on commit 9010081

Please sign in to comment.