[VLM] add content-addressed preprocessing cache infrastructure (#34398)
This commit is contained in:
@@ -138,6 +138,31 @@ class TestTemplateContentFormatDetection(CustomTestCase):
|
||||
self.assertEqual(result["content"], expected_content)
|
||||
self.assertEqual(result["role"], "user")
|
||||
|
||||
def test_process_content_preserves_image_content_hash(self):
|
||||
content_hash = "sha256:" + "ab" * 32
|
||||
image_data = []
|
||||
result = process_content_for_template_format(
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "image_url",
|
||||
"image_url": {
|
||||
"url": "http://example.com/image.jpg",
|
||||
"content_hash": content_hash,
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
"openai",
|
||||
image_data,
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
)
|
||||
self.assertEqual(result["content"], [{"type": "image"}])
|
||||
self.assertEqual(image_data[0].content_hash, content_hash)
|
||||
|
||||
def test_process_content_string_format(self):
|
||||
"""Test content processing for string format."""
|
||||
msg_dict = {
|
||||
|
||||
Reference in New Issue
Block a user