|
4 | 4 | % CHAT = azureChat(endpoint, deploymentID) creates an azureChat object with the
|
5 | 5 | % endpoint and deployment ID path parameters required by Azure to establish the connection.
|
6 | 6 | %
|
7 |
| -% CHAT = azureChat(__,systemPrompt) creates an azureChatobject with the |
| 7 | +% CHAT = azureChat(__,systemPrompt) creates an azureChat object with the |
8 | 8 | % specified system prompt.
|
9 | 9 | %
|
10 | 10 | % CHAT = azureChat(__,Name=Value) specifies additional options
|
|
178 | 178 | end
|
179 | 179 |
|
180 | 180 | toolChoice = convertToolChoice(this, nvp.ToolChoice);
|
181 |
| - [text, message, response] = llms.internal.callAzureChatAPI(this.Endpoint, ... |
182 |
| - this.DeploymentID, messagesStruct, this.FunctionsStruct, ... |
183 |
| - ToolChoice=toolChoice, APIVersion = this.APIVersion, Temperature=this.Temperature, ... |
184 |
| - TopProbabilityMass=this.TopProbabilityMass, NumCompletions=nvp.NumCompletions,... |
185 |
| - StopSequences=this.StopSequences, MaxNumTokens=nvp.MaxNumTokens, ... |
186 |
| - PresencePenalty=this.PresencePenalty, FrequencyPenalty=this.FrequencyPenalty, ... |
187 |
| - ResponseFormat=this.ResponseFormat,Seed=nvp.Seed, ... |
188 |
| - APIKey=this.APIKey,TimeOut=this.TimeOut, StreamFun=this.StreamFun); |
| 181 | + try |
| 182 | + [text, message, response] = llms.internal.callAzureChatAPI(this.Endpoint, ... |
| 183 | + this.DeploymentID, messagesStruct, this.FunctionsStruct, ... |
| 184 | + ToolChoice=toolChoice, APIVersion = this.APIVersion, Temperature=this.Temperature, ... |
| 185 | + TopProbabilityMass=this.TopProbabilityMass, NumCompletions=nvp.NumCompletions,... |
| 186 | + StopSequences=this.StopSequences, MaxNumTokens=nvp.MaxNumTokens, ... |
| 187 | + PresencePenalty=this.PresencePenalty, FrequencyPenalty=this.FrequencyPenalty, ... |
| 188 | + ResponseFormat=this.ResponseFormat,Seed=nvp.Seed, ... |
| 189 | + APIKey=this.APIKey,TimeOut=this.TimeOut, StreamFun=this.StreamFun); |
| 190 | + catch ME |
| 191 | + if ismember(ME.identifier,... |
| 192 | + ["MATLAB:webservices:UnknownHost","MATLAB:webservices:Timeout"]) |
| 193 | + % throw(ME)would still print a long stack trace, from |
| 194 | + % ME.cause.stack. We cannot change ME.cause, so we |
| 195 | + % throw a new error: |
| 196 | + error(ME.identifier,ME.message); |
| 197 | + end |
| 198 | + rethrow(ME); |
| 199 | + end |
189 | 200 |
|
190 | 201 | if isfield(response.Body.Data,"error")
|
191 | 202 | err = response.Body.Data.error.message;
|
|
0 commit comments