1+ classdef texampleTests < matlab .unittest .TestCase
2+ % Smoke level tests for the example .mlx files
3+
4+ % Copyright 2024 The MathWorks, Inc.
5+
6+ methods (TestClassSetup )
7+ function setUpAndTearDowns(testCase )
8+ openAIEnvVar = " OPENAI_KEY" ;
9+ secretKey = getenv(openAIEnvVar );
10+ % Create an empty .env file because it is expected by our .mlx
11+ % example files
12+ writelines(" " ," .env" );
13+
14+ % Assign the value of the secret key to OPENAI_API_KEY using
15+ % the test fixture
16+ import matlab .unittest .fixtures .EnvironmentVariableFixture
17+ fixture = EnvironmentVariableFixture(" OPENAI_API_KEY" , secretKey );
18+ testCase .applyFixture(fixture );
19+
20+ testCase .addTeardown(@() iCloseAll());
21+ end
22+ end
23+
24+ methods (Test )
25+ function testAnalyzeScientificPapersUsingFunctionCalls(~)
26+ AnalyzeScientificPapersUsingFunctionCalls ;
27+ end
28+
29+ function testProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode(~)
30+ ProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode ;
31+ end
32+
33+ function testUsingDALLEToGenerateImages(~)
34+ UsingDALLEToGenerateImages ;
35+ end
36+
37+ function testInformationRetrievalUsingOpenAIDocumentEmbedding(~)
38+ InformationRetrievalUsingOpenAIDocumentEmbedding ;
39+ end
40+
41+ function testDescribeImagesUsingChatGPT(~)
42+ DescribeImagesUsingChatGPT ;
43+ end
44+
45+ function testSummarizeLargeDocumentsUsingChatGPTandMATLAB(~)
46+ SummarizeLargeDocumentsUsingChatGPTandMATLAB ;
47+ end
48+
49+ function testAnalyzeTextDataUsingParallelFunctionCallwithChatGPT(~)
50+ AnalyzeTextDataUsingParallelFunctionCallwithChatGPT ;
51+ end
52+
53+ function testRetrievalAugmentedGenerationUsingChatGPTandMATLAB(~)
54+ RetrievalAugmentedGenerationUsingChatGPTandMATLAB ;
55+ end
56+ end
57+
58+ end
59+
60+ function iCloseAll()
61+ % Close all opened figures
62+ allFig = findall(0 , ' type' , ' figure' );
63+ close(allFig )
64+ end
0 commit comments