Skip to content

[Serve][LLM] Add regression test for nested dict in engine_kwargs#60430

Merged
kouroshHakha merged 9 commits intoray-project:masterfrom
eicherseiji:test-namespace-conversion
Jan 27, 2026
Merged

[Serve][LLM] Add regression test for nested dict in engine_kwargs#60430
kouroshHakha merged 9 commits intoray-project:masterfrom
eicherseiji:test-namespace-conversion

Conversation

@eicherseiji
Copy link
Contributor

@eicherseiji eicherseiji commented Jan 22, 2026

Summary

Add a release integration test that verifies vLLM engine can start with nested dicts in engine_kwargs (e.g., structured_outputs_config).

This test serves as a regression test for #60380. Without that fix, this test fails with:

AttributeError: 'dict' object has no attribute 'backend'

The test ensures that nested dicts are properly converted to argparse.Namespace objects so vLLM's init_app_state() can access nested attributes via dot notation.

Test plan

Related: #60380

Add a GPU test that verifies vLLM engine can start with nested dicts
in engine_kwargs (e.g., structured_outputs_config). This test will fail
without the fix from PR ray-project#60380 with:

    AttributeError: 'dict' object has no attribute 'backend'

The test ensures that nested dicts are properly converted to
argparse.Namespace objects so vLLM's init_app_state() can access
nested attributes via dot notation.

See: ray-project#60380
Signed-off-by: Seiji Eicher <seiji@anyscale.com>
@eicherseiji eicherseiji requested a review from a team as a code owner January 22, 2026 23:13
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a valuable regression test to verify that vLLM engines can be initialized with nested dictionaries in engine_kwargs. The test case is well-defined and directly addresses the issue described. I have a couple of suggestions to improve the test's robustness regarding resource cleanup and to address a potential issue with a method call that might not exist.

@eicherseiji eicherseiji marked this pull request as draft January 22, 2026 23:16
Move regression test for nested dict in engine_kwargs from GPU tests
to release/llm_tests/serve/test_llm_serve_integration.py where it
properly exercises the full vLLM integration path.

Signed-off-by: Seiji Eicher <seiji@anyscale.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Signed-off-by: Seiji Eicher <seiji@anyscale.com>
@eicherseiji eicherseiji added the go add ONLY when ready to merge, run all tests label Jan 22, 2026
eicherseiji and others added 3 commits January 22, 2026 15:54
When users pass dicts for vLLM config fields like structured_outputs_config,
compilation_config, etc. in engine_kwargs, they need to be converted to
their proper dataclass types (not argparse.Namespace) so that default
field values are populated correctly.

Without this fix, passing `structured_outputs_config={"backend": "xgrammar"}`
causes AttributeError when vLLM tries to access default fields like
`reasoning_parser` that don't exist on the Namespace object.

The fix uses typing.get_type_hints() to inspect AsyncEngineArgs and
automatically convert dict values to their expected dataclass types.
This handles all current and future config dataclass fields generically.

Signed-off-by: Seiji Eicher <seiji@anyscale.com>
…seiji/ray into test-namespace-conversion

Signed-off-by: Seiji Eicher <seiji@anyscale.com>

# Conflicts:
#	python/ray/llm/_internal/serve/engines/vllm/vllm_engine.py
@eicherseiji eicherseiji marked this pull request as ready for review January 26, 2026 18:53
@eicherseiji
Copy link
Contributor Author

@ray-gardener ray-gardener bot added serve Ray Serve Related Issue release-test release test llm labels Jan 26, 2026
@eicherseiji
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses the regression issue by introducing a robust mechanism to convert nested dictionaries within engine_kwargs into their appropriate vLLM dataclass types. The _convert_config_dicts function correctly handles optional types and gracefully logs warnings for conversion failures, ensuring the system remains resilient. The addition of a dedicated regression test (test_nested_engine_kwargs_structured_outputs) provides excellent coverage and verifies the fix's effectiveness. Overall, the changes are well-implemented, maintainable, and directly resolve the identified problem.

@eicherseiji
Copy link
Contributor Author

The release test failure //doc:source/data/doc_code/working-with-llms/basic_llm_example is also seen on master. Seems to be a transformers version issue. Trying to locate the offending commit

@eicherseiji
Copy link
Contributor Author

Fixing here #60507

@kouroshHakha kouroshHakha changed the title [LLM] Add regression test for nested dict in engine_kwargs [Serve][LLM] Add regression test for nested dict in engine_kwargs Jan 27, 2026
@kouroshHakha kouroshHakha merged commit 18981ac into ray-project:master Jan 27, 2026
6 checks passed
jinbum-kim pushed a commit to jinbum-kim/ray that referenced this pull request Jan 29, 2026
…y-project#60430)

Signed-off-by: Seiji Eicher <seiji@anyscale.com>
Signed-off-by: jinbum-kim <jinbum9958@gmail.com>
limarkdcunha pushed a commit to limarkdcunha/ray that referenced this pull request Jan 29, 2026
400Ping pushed a commit to 400Ping/ray that referenced this pull request Feb 1, 2026
…y-project#60430)

Signed-off-by: Seiji Eicher <seiji@anyscale.com>
Signed-off-by: 400Ping <jiekaichang@apache.org>
ans9868 pushed a commit to ans9868/ray that referenced this pull request Feb 18, 2026
…y-project#60430)

Signed-off-by: Seiji Eicher <seiji@anyscale.com>
Signed-off-by: Adel Nour <ans9868@nyu.edu>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
…y-project#60430)

Signed-off-by: Seiji Eicher <seiji@anyscale.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
…y-project#60430)

Signed-off-by: Seiji Eicher <seiji@anyscale.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests llm release-test release test serve Ray Serve Related Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants