@@ -16,7 +16,8 @@ function saveEnvVar(testCase)
16
16
end
17
17
18
18
properties (TestParameter )
19
- InvalidInput = iGetInvalidInput;
19
+ InvalidInput = iGetInvalidInput();
20
+ ValidDimensionsModelCombinations = iGetValidDimensionsModelCombinations();
20
21
end
21
22
22
23
methods (Test )
@@ -31,6 +32,18 @@ function keyNotFound(testCase)
31
32
testCase .verifyError(@()extractOpenAIEmbeddings(" bla" ), " llms:keyMustBeSpecified" );
32
33
end
33
34
35
+ function validCombinationOfModelAndDimension(testCase , ValidDimensionsModelCombinations )
36
+ testCase .verifyWarningFree(@()extractOpenAIEmbeddings(" bla" , ...
37
+ Dimensions= ValidDimensionsModelCombinations .Dimensions ,...
38
+ ModelName= ValidDimensionsModelCombinations .ModelName , ...
39
+ ApiKey= " not-real" ));
40
+ end
41
+
42
+ function embedStringWithSuccessfulOpenAICall(testCase )
43
+ testCase .verifyWarningFree(@()extractOpenAIEmbeddings(" bla" , ...
44
+ ApiKey= getenv(" OPENAI_KEY" )));
45
+ end
46
+
34
47
function invalidCombinationOfModelAndDimension(testCase )
35
48
testCase .verifyError(@()extractOpenAIEmbeddings(" bla" , ...
36
49
Dimensions= 10 ,...
@@ -54,7 +67,7 @@ function testInvalidInputs(testCase, InvalidInput)
54
67
end
55
68
end
56
69
57
- function invalidInput = iGetInvalidInput
70
+ function invalidInput = iGetInvalidInput()
58
71
invalidInput = struct( ...
59
72
" InvalidEmptyText" , struct( ...
60
73
" Input" ,{{ " " }},...
@@ -117,4 +130,15 @@ function testInvalidInputs(testCase, InvalidInput)
117
130
" InvalidApiKeySize" ,struct( ...
118
131
" Input" ,{{" bla" , " ApiKey" [" abc" " abc" ] }},...
119
132
" Error" ," MATLAB:validators:mustBeTextScalar" ));
120
- end
133
+ end
134
+
135
+ function validDimensionsModelCombinations = iGetValidDimensionsModelCombinations()
136
+ validDimensionsModelCombinations = struct( ...
137
+ " CaseTextEmbedding3Small" , struct( ...
138
+ " Dimensions" ,10 ,...
139
+ " ModelName" , " text-embedding-3-small" ), ...
140
+ ...
141
+ " CaseTextEmbedding3Large" , struct( ...
142
+ " Dimensions" ,10 ,...
143
+ " ModelName" , " text-embedding-3-large" ));
144
+ end
0 commit comments