File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -99,13 +99,20 @@ function seedFixesResult(testCase)
9999 end
100100
101101 function generateWithImages(testCase )
102+ import matlab .unittest .constraints .ContainsSubstring
102103 chat = ollamaChat(" moondream" );
103104 image_path = " peppers.png" ;
104105 emptyMessages = messageHistory ;
105106 messages = addUserMessageWithImages(emptyMessages ," What is in the image?" ,image_path );
106107
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" ));
109116 end
110117
111118 function streamFunc(testCase )
You can’t perform that action at this time.
0 commit comments