File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -99,13 +99,20 @@ function seedFixesResult(testCase)
99
99
end
100
100
101
101
function generateWithImages(testCase )
102
+ import matlab .unittest .constraints .ContainsSubstring
102
103
chat = ollamaChat(" moondream" );
103
104
image_path = " peppers.png" ;
104
105
emptyMessages = messageHistory ;
105
106
messages = addUserMessageWithImages(emptyMessages ," What is in the image?" ,image_path );
106
107
107
- text = generate(chat ,messages );
108
- testCase .verifyThat(text ,matlab .unittest .constraints .ContainsSubstring(" pepper" ));
108
+ % The moondream model is small and unreliable. We are not
109
+ % testing the model, we are testing that we send images to
110
+ % Ollama in the right way. So we just ask several times and
111
+ % are happy when one of the responses mentions "pepper" or
112
+ % "vegetable".
113
+ text = arrayfun(@(~) generate(chat ,messages ), 1 : 5 , UniformOutput= false );
114
+ text = join([text{: }],newline +" -----" +newline );
115
+ testCase .verifyThat(text ,ContainsSubstring(" pepper" ) | ContainsSubstring(" vegetable" ));
109
116
end
110
117
111
118
function streamFunc(testCase )
You can’t perform that action at this time.
0 commit comments