Skip to content

Commit 9010081

Browse files
committed
Eliminated validation related to removed models
1 parent 03cb841 commit 9010081

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

openAIChat.m

+4-21
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,6 @@
131131

132132
if isfield(nvp,"StreamFun")
133133
this.StreamFun = nvp.StreamFun;
134-
if strcmp(nvp.ModelName,'gpt-4-vision-preview')
135-
error("llms:invalidOptionForModel", ...
136-
llms.utils.errorMessageCatalog.getMessage("llms:invalidOptionForModel", "StreamFun", nvp.ModelName));
137-
end
138134
else
139135
this.StreamFun = [];
140136
end
@@ -146,10 +142,6 @@
146142
else
147143
this.Tools = nvp.Tools;
148144
[this.FunctionsStruct, this.FunctionNames] = functionAsStruct(nvp.Tools);
149-
if strcmp(nvp.ModelName,'gpt-4-vision-preview')
150-
error("llms:invalidOptionForModel", ...
151-
llms.utils.errorMessageCatalog.getMessage("llms:invalidOptionForModel", "Tools", nvp.ModelName));
152-
end
153145
end
154146

155147
if ~isempty(systemPrompt)
@@ -163,20 +155,15 @@
163155
this.Temperature = nvp.Temperature;
164156
this.TopProbabilityMass = nvp.TopProbabilityMass;
165157
this.StopSequences = nvp.StopSequences;
166-
if ~isempty(nvp.StopSequences) && strcmp(nvp.ModelName,'gpt-4-vision-preview')
167-
error("llms:invalidOptionForModel", ...
168-
llms.utils.errorMessageCatalog.getMessage("llms:invalidOptionForModel", "StopSequences", nvp.ModelName));
169-
end
170-
171158

172159
% ResponseFormat is only supported in the latest models only
173160
if (nvp.ResponseFormat == "json")
174-
if ismember(this.ModelName,["gpt-3.5-turbo-1106","gpt-4-1106-preview"])
175-
warning("llms:warningJsonInstruction", ...
176-
llms.utils.errorMessageCatalog.getMessage("llms:warningJsonInstruction"))
177-
else
161+
if ismember(this.ModelName,["gpt-4","gpt-4-0613"])
178162
error("llms:invalidOptionAndValueForModel", ...
179163
llms.utils.errorMessageCatalog.getMessage("llms:invalidOptionAndValueForModel", "ResponseFormat", "json", this.ModelName));
164+
else
165+
warning("llms:warningJsonInstruction", ...
166+
llms.utils.errorMessageCatalog.getMessage("llms:warningJsonInstruction"))
180167
end
181168

182169
end
@@ -222,10 +209,6 @@
222209
end
223210

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

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

0 commit comments

Comments
 (0)