Skip to content

test(serve): cover user images across three HTTP APIs - #5046

Open
silencelamb wants to merge 5 commits into
InternLM:mainfrom
silencelamb:test/user-images-three-protocols
Open

silencelamb wants to merge 5 commits into
InternLM:mainfrom
silencelamb:test/user-images-three-protocols

Conversation

@silencelamb

@silencelamb silencelamb commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Equivalent user-image requests should preserve image contents, text order, and conversation history across /v1/chat/completions, /v1/messages, and /v1/responses. Use a small shared set of scenarios to check these invariants across all three entry points.

Modification

Add tests/test_lmdeploy/serve/test_user_images.py with three representative PNG scenarios:

Scenario Image source Shared assertions
Image-only user message Data URL Image reaches preprocessing without requiring text
Multiple images interleaved with text HTTP URLs Decoded image contents and text/image order are preserved
Images in separate conversation turns Data URLs Roles, assistant text, and image history are preserved

Each scenario runs through all three APIs in both non-streaming and SSE modes, also checking successful completion and session cleanup: 18 HTTP cases.

Six additional checks use protocol conversion and shared preprocessing directly to ensure corrupt image data is rejected and text-only models reject images, once per protocol.

The suite uses production routing, protocol conversion, media loading, and image decoding. Generation and remote HTTP transport are simulated; no model weights, GPU service, or external network access are required.

Test scope

This file owns representative cross-endpoint invariants, not a Cartesian product of image formats, sources, and conversation shapes. PNG/JPEG/WEBP decoder coverage, SDK compatibility, image parameters, and detailed protocol validation remain in the existing endpoint suites, including openai/responses/test_images.py.

A few successful image flows intentionally overlap with the focused Responses regression tests so that #5043 remains independently validated. Tool-result images and their three-endpoint regressions belong to #5044.

BC-breaking (Optional)

None. The incremental change adds one test file without changing production code or dependencies.

Validation

  • Complete serving suite at 70689117: 510 passed (python -m pytest tests/test_lmdeploy/serve -q), including all 24 shared image checks.
  • Applicable pre-commit hooks and git diff --check passed.
  • No GPU service was started. Earlier real GLM-5.3-Flash validation is recorded in [Fix] Handle user image inputs in Responses API #5043; these tests do not validate model generation.

Dependency and review scope

This PR depends on #5043, which enables ordinary user images in Responses. It does not depend on #5044.

Until #5043 merges, the upstream main diff also includes that prerequisite. The incremental test-only comparison adds only tests/test_lmdeploy/serve/test_user_images.py. This branch should be rebased onto upstream after #5043 merges.

Checklist

  • Applicable pre-commit hooks and whitespace checks passed.
  • The complete serving test suite passed.
  • No new dependency or downstream minimum-version requirement.
  • Test scope and simulated components are documented in the test module.

Add one shared HTTP/SSE image matrix for Chat, Messages, and Responses, exercising PNG/JPEG/WEBP, data and HTTP URLs, image-only input, interleaved multiple images, and multi-turn history with real image decoding. Keep protocol-specific Responses validation tests separate.

Cover corrupt-image rejection and text-only model rejection for all three protocols. Generation and remote HTTP transport are simulated; no GPU service is started.
@silencelamb silencelamb changed the title [Test] Cover user images across three HTTP APIs test(serve): cover user images across three HTTP APIs Oct 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant