|
1 | 1 | classdef tazureChat < hopenAIChat
|
2 | 2 | % Tests for azureChat
|
3 | 3 |
|
4 |
| -% Copyright 2024 The MathWorks, Inc. |
| 4 | +% Copyright 2024-2025 The MathWorks, Inc. |
5 | 5 |
|
6 | 6 | properties(TestParameter)
|
7 | 7 | ValidConstructorInput = iGetValidConstructorInput();
|
@@ -69,6 +69,20 @@ function responseFormatRequiresNewAPI(testCase)
|
69 | 69 | "llms:structuredOutputRequiresAPI");
|
70 | 70 | end
|
71 | 71 |
|
| 72 | + function maxNumTokensWithReasoningModel(testCase) |
| 73 | + % Unlike OpenAI, Azure requires different parameter names for |
| 74 | + % different models (max_tokens vs max_completion_tokens). Since |
| 75 | + % we do not even know what model some deployment uses (us naming |
| 76 | + % them after the model deployed is not a guarantee), that is a |
| 77 | + % somewhat painful distinction. |
| 78 | + testCase.verifyWarningFree(@() generate( ... |
| 79 | + azureChat(DeploymentID="gpt-35-turbo-16k-0613"), ... |
| 80 | + "What is object oriented design?", MaxNumTokens=23)); |
| 81 | + testCase.verifyWarningFree(@() generate( ... |
| 82 | + azureChat(DeploymentID="o1-mini"), ... |
| 83 | + "What is object oriented design?", MaxNumTokens=23)); |
| 84 | + end |
| 85 | + |
72 | 86 | function generateWithImage(testCase)
|
73 | 87 | chat = azureChat(DeploymentID="gpt-4o");
|
74 | 88 | image_path = "peppers.png";
|
@@ -123,10 +137,10 @@ function canUseAPIVersions(testCase, APIVersions)
|
123 | 137 | end
|
124 | 138 |
|
125 | 139 | function specialErrorForUnsupportedResponseFormat(testCase)
|
126 |
| - testCase.assumeFail("Disabled until `llms.internal.callAzureChat` is updated to use `max_completion_tokens` instead of the deprecated `max_tokens` in the OpenAI API.") |
127 |
| - |
| 140 | + % Our "gpt-4o" deployment has the model version 2024-05-13, |
| 141 | + % which does not support structured output |
128 | 142 | testCase.verifyError(@() generate(...
|
129 |
| - azureChat(DeploymentID="o1-mini"), ... |
| 143 | + azureChat(DeploymentID="gpt-4o"), ... |
130 | 144 | "What is the smallest prime?", ...
|
131 | 145 | ResponseFormat=struct("number",1)), ...
|
132 | 146 | "llms:noStructuredOutputForAzureDeployment");
|
|
0 commit comments