5
5
6
6
properties (TestParameter )
7
7
InvalidInput = iGetInvalidInput();
8
+ ValidInput = iGetValidInput();
8
9
ValidDimensionsModelCombinations = iGetValidDimensionsModelCombinations();
9
10
end
10
11
@@ -34,8 +35,9 @@ function validCombinationOfModelAndDimension(testCase, ValidDimensionsModelCombi
34
35
APIKey= " not-real" ));
35
36
end
36
37
37
- function embedStringWithSuccessfulOpenAICall(testCase )
38
- testCase .verifyWarningFree(@()extractOpenAIEmbeddings(" bla" ));
38
+ function embedTextWithSuccessfulOpenAICall(testCase ,ValidInput )
39
+ result = testCase .verifyWarningFree(@()extractOpenAIEmbeddings(ValidInput.Input{: }));
40
+ testCase .verifySize(result , ValidInput .ExpectedSize );
39
41
end
40
42
41
43
function invalidCombinationOfModelAndDimension(testCase )
@@ -57,6 +59,31 @@ function testInvalidInputs(testCase, InvalidInput)
57
59
end
58
60
end
59
61
62
+ function validInput = iGetValidInput()
63
+ validInput = struct( ...
64
+ " ScalarString" , struct( ...
65
+ " Input" ,{{ " blah" }}, ...
66
+ " ExpectedSize" ,[1 ,1536 ]), ...
67
+ " StringVector" , struct( ...
68
+ " Input" ,{{ [" a" , " b" , " c" ] }}, ...
69
+ " ExpectedSize" ,[3 ,1536 ]), ...
70
+ " CharVector" , struct( ...
71
+ " Input" , {{ ' foo' }}, ...
72
+ " ExpectedSize" ,[1 ,1536 ]), ...
73
+ " Cellstr" , struct( ...
74
+ " Input" ,{{ {' cat' , ' dog' , ' mouse' } }}, ...
75
+ " ExpectedSize" ,[3 ,1536 ]), ...
76
+ " ModelAsString" , struct( ...
77
+ " Input" ,{{ " foo" ," ModelName" ," text-embedding-3-small" }}, ...
78
+ " ExpectedSize" ,[1 ,1536 ]), ...
79
+ " ModelAsChar" , struct( ...
80
+ " Input" ,{{ " foo" ," ModelName" ,' text-embedding-3-small' }}, ...
81
+ " ExpectedSize" ,[1 ,1536 ]), ...
82
+ " ModelAsCellstr" , struct( ...
83
+ " Input" ,{{ " foo" ," ModelName" ,{' text-embedding-3-small' } }}, ...
84
+ " ExpectedSize" ,[1 ,1536 ]));
85
+ end
86
+
60
87
function invalidInput = iGetInvalidInput()
61
88
invalidInput = struct( ...
62
89
" InvalidEmptyText" , struct( ...
0 commit comments