-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from matlab-deep-learning/add_example_tests
Add example tests
- Loading branch information
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file modified
BIN
+208 Bytes
(100%)
examples/RetrievalAugmentedGenerationUsingChatGPTandMATLAB.mlx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
classdef texampleTests < matlab.unittest.TestCase | ||
% Smoke level tests for the example .mlx files | ||
|
||
% Copyright 2024 The MathWorks, Inc. | ||
|
||
methods (TestClassSetup) | ||
function setUpAndTearDowns(testCase) | ||
openAIEnvVar = "OPENAI_KEY"; | ||
secretKey = getenv(openAIEnvVar); | ||
% Create an empty .env file because it is expected by our .mlx | ||
% example files | ||
writelines("",".env"); | ||
|
||
% Assign the value of the secret key to OPENAI_API_KEY using | ||
% the test fixture | ||
import matlab.unittest.fixtures.EnvironmentVariableFixture | ||
fixture = EnvironmentVariableFixture("OPENAI_API_KEY", secretKey); | ||
testCase.applyFixture(fixture); | ||
|
||
testCase.addTeardown(@() iCloseAll()); | ||
end | ||
end | ||
|
||
methods(Test) | ||
function testAnalyzeScientificPapersUsingFunctionCalls(~) | ||
AnalyzeScientificPapersUsingFunctionCalls; | ||
end | ||
|
||
function testProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode(~) | ||
ProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode; | ||
end | ||
|
||
function testUsingDALLEToGenerateImages(~) | ||
UsingDALLEToGenerateImages; | ||
end | ||
|
||
function testInformationRetrievalUsingOpenAIDocumentEmbedding(~) | ||
InformationRetrievalUsingOpenAIDocumentEmbedding; | ||
end | ||
|
||
function testDescribeImagesUsingChatGPT(~) | ||
DescribeImagesUsingChatGPT; | ||
end | ||
|
||
function testSummarizeLargeDocumentsUsingChatGPTandMATLAB(~) | ||
SummarizeLargeDocumentsUsingChatGPTandMATLAB; | ||
end | ||
|
||
function testAnalyzeTextDataUsingParallelFunctionCallwithChatGPT(~) | ||
AnalyzeTextDataUsingParallelFunctionCallwithChatGPT; | ||
end | ||
|
||
function testRetrievalAugmentedGenerationUsingChatGPTandMATLAB(~) | ||
RetrievalAugmentedGenerationUsingChatGPTandMATLAB; | ||
end | ||
end | ||
|
||
end | ||
|
||
function iCloseAll() | ||
% Close all opened figures | ||
allFig = findall(0, 'type', 'figure'); | ||
close(allFig) | ||
end |