55
66 properties (TestParameter )
77 InvalidInput = iGetInvalidInput();
8+ ValidInput = iGetValidInput();
89 ValidDimensionsModelCombinations = iGetValidDimensionsModelCombinations();
910 end
1011
@@ -34,8 +35,9 @@ function validCombinationOfModelAndDimension(testCase, ValidDimensionsModelCombi
3435 APIKey= " not-real" ));
3536 end
3637
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 );
3941 end
4042
4143 function invalidCombinationOfModelAndDimension(testCase )
@@ -57,6 +59,31 @@ function testInvalidInputs(testCase, InvalidInput)
5759 end
5860end
5961
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+
6087function invalidInput = iGetInvalidInput()
6188invalidInput = struct( ...
6289 " InvalidEmptyText" , struct( ...
0 commit comments