@@ -20,18 +20,19 @@ def create_server():
20
20
21
21
22
22
@pytest .mark .parametrize (
23
- "image_url, success, re_content" ,
23
+ "prompt, image_url, success, re_content" ,
24
24
[
25
25
# test model is trained on CIFAR-10, but it's quite dumb due to small size
26
- (IMG_URL_0 , True , "(cat)+" ),
27
- ("IMG_BASE64_0" , True , "(cat)+" ), # exceptional, so that we don't cog up the log
28
- (IMG_URL_
10000
1 , True , "(frog)+" ),
29
- ("malformed" , False , None ),
30
- ("https://google.com/404" , False , None ), # non-existent image
31
- ("https://ggml.ai" , False , None ), # non-image data
26
+ ("What is this:\n " , IMG_URL_0 , True , "(cat)+" ),
27
+ ("What is this:\n " , "IMG_BASE64_0" , True , "(cat)+" ), # exceptional, so that we don't cog up the log
28
+ ("What is this:\n " , IMG_URL_1 , True , "(frog)+" ),
29
+ ("Test test\n " , IMG_URL_1 , True , "(frog)+" ), # test invalidate cache
30
+ ("What is this:\n " , "malformed" , False , None ),
31
+ ("What is this:\n " , "https://google.com/404" , False , None ), # non-existent image
32
+ ("What is this:\n " , "https://ggml.ai" , False , None ), # non-image data
32
33
]
33
34
)
34
- def test_vision_chat_completion (image_url , success , re_content ):
35
+ def test_vision_chat_completion (prompt , image_url , success , re_content ):
35
36
global server
36
37
server .start (timeout_seconds = 60 ) # vision model may take longer to load due to download size
37
38
if image_url == "IMG_BASE64_0" :
@@ -41,7 +42,7 @@ def test_vision_chat_completion(image_url, success, re_content):
41
42
"top_k" : 1 ,
42
43
"messages" : [
43
44
{"role" : "user" , "content" : [
44
- {"type" : "text" , "text" : "What is this: \n " },
45
+ {"type" : "text" , "text" : prompt },
45
46
{"type" : "image_url" , "image_url" : {
46
47
"url" : image_url ,
47
48
}},
0 commit comments