[VLM] add content-addressed preprocessing cache infrastructure (#34398)

This commit is contained in:
Mick
2026-08-13 14:09:07 +08:00
committed by GitHub
parent 035c622a14
commit e8c7dddfa0
18 changed files with 1288 additions and 2 deletions
@@ -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 = {