[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
@@ -19,6 +19,7 @@ from typing import List, Optional
from pydantic import BaseModel, Field, ValidationError
from sglang.srt.entrypoints.openai.protocol import (
ChatCompletionMessageContentImageURL,
ChatCompletionRequest,
ChatCompletionResponse,
ChatCompletionResponseChoice,
@@ -125,6 +126,17 @@ class TestChatCompletionRequest(unittest.TestCase):
self.assertFalse(request.stream) # default
self.assertEqual(request.tool_choice, "none") # default when no tools
def test_image_content_hash_validation(self):
digest = "sha256:" + "AB" * 32
image = ChatCompletionMessageContentImageURL(
url="https://example.com/image.jpg", content_hash=digest
)
self.assertEqual(image.content_hash, digest.lower())
with self.assertRaises(ValidationError):
ChatCompletionMessageContentImageURL(
url="https://example.com/image.jpg", content_hash="not-a-hash"
)
def test_sampling_param_build(self):
req = ChatCompletionRequest(
model="x",