Skip to content

Commit

Permalink
Fix azureChat issue with APIVersion, Endpoint and Deployment arguments
Browse files Browse the repository at this point in the history
APIVersion, Endpoint and Deployment arguments did not cast char arrays to strings. Fixed that so char arrays strings are accepted as inputs of these arguments.
  • Loading branch information
vpapanasta committed Jun 27, 2024
1 parent 4cd9047 commit fbf1372
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions azureChat.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@
function this = azureChat(systemPrompt, nvp)
arguments
systemPrompt {llms.utils.mustBeTextOrEmpty} = []
nvp.Endpoint {mustBeNonzeroLengthTextScalar}
nvp.Deployment {mustBeNonzeroLengthTextScalar}
nvp.Endpoint (1,1) string {mustBeNonzeroLengthTextScalar}
nvp.Deployment (1,1) string {mustBeNonzeroLengthTextScalar}
nvp.APIKey {mustBeNonzeroLengthTextScalar}
nvp.Tools (1,:) {mustBeA(nvp.Tools, "openAIFunction")} = openAIFunction.empty
nvp.APIVersion (1,1) {mustBeAPIVersion} = "2024-02-01"
nvp.APIVersion (1,1) string {mustBeAPIVersion} = "2024-02-01"
nvp.Temperature {llms.utils.mustBeValidTemperature} = 1
nvp.TopP {llms.utils.mustBeValidTopP} = 1
nvp.StopSequences {llms.utils.mustBeValidStop} = {}
Expand Down
2 changes: 1 addition & 1 deletion tests/tazureChat.m
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function canUseAPIVersions(testCase, APIVersions)
% azureChat.generate

testCase.assumeTrue(isenv("AZURE_OPENAI_API_KEY"),"end-to-end test requires environment variables AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT, and AZURE_OPENAI_DEPLOYMENT.");
chat = azureChat("APIVersion", string(APIVersions));
chat = azureChat("APIVersion", APIVersions);

response = testCase.verifyWarningFree(@() generate(chat,"How similar is the DNA of a cat and a tiger?"));
testCase.verifyClass(response,'string');
Expand Down

0 comments on commit fbf1372

Please sign in to comment.