@@ -41,6 +41,14 @@ function doGenerate(testCase,StringInputs)
4141 testCase .verifyGreaterThan(strlength(response ),0 );
4242 end
4343
44+ function doGenerateUsingSystemPrompt(testCase )
45+ 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." );
46+ chat = azureChat(" You are a helpful assistant" );
47+ response = testCase .verifyWarningFree(@() generate(chat ," Hi" ));
48+ testCase .verifyClass(response ,' string' );
49+ testCase .verifyGreaterThan(strlength(response ),0 );
50+ end
51+
4452 function generateMultipleResponses(testCase )
4553 chat = azureChat ;
4654 [~ ,~ ,response ] = generate(chat ," What is a cat?" ,NumCompletions= 3 );
@@ -162,7 +170,26 @@ function canUseAPIVersions(testCase, APIVersions)
162170 response = testCase .verifyWarningFree(@() generate(chat ," How similar is the DNA of a cat and a tiger?" ));
163171 testCase .verifyClass(response ,' string' );
164172 testCase .verifyGreaterThan(strlength(response ),0 );
173+ end
165174
175+ function endpointNotFound(testCase )
176+ % to verify the error, we need to unset the environment variable
177+ % AZURE_OPENAI_ENDPOINT, if given. Use a fixture to restore the
178+ % value on leaving the test point
179+ import matlab .unittest .fixtures .EnvironmentVariableFixture
180+ testCase .applyFixture(EnvironmentVariableFixture(" AZURE_OPENAI_ENDPOINT" ," dummy" ));
181+ unsetenv(" AZURE_OPENAI_ENDPOINT" );
182+ testCase .verifyError(@()azureChat , " llms:endpointMustBeSpecified" );
183+ end
184+
185+ function deploymentNotFound(testCase )
186+ % to verify the error, we need to unset the environment variable
187+ % AZURE_OPENAI_DEPLOYMENT, if given. Use a fixture to restore the
188+ % value on leaving the test point
189+ import matlab .unittest .fixtures .EnvironmentVariableFixture
190+ testCase .applyFixture(EnvironmentVariableFixture(" AZURE_OPENAI_DEPLOYMENT" ," dummy" ));
191+ unsetenv(" AZURE_OPENAI_DEPLOYMENT" );
192+ testCase .verifyError(@()azureChat , " llms:deploymentMustBeSpecified" );
166193 end
167194 end
168195end
0 commit comments