A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
[Docs] Reduce noise in docs and `--help` from the JSON tip (#22567)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Harry Mellor committed
Aug 9, 2025 at 16:31 UTC
56186474f6afef825943fb5c5b1ad288909b6783
4 files changed
+40
-24
docs/cli/README.md
+10
@@ -16,6 +16,16 @@ Available Commands:
16
vllm {chat,complete,serve,bench,collect-env,run-batch}
17
```
18
19
+When passing JSON CLI arguments, the following sets of arguments are equivalent:
20
+
21
+- `--json-arg '{"key1": "value1", "key2": {"key3": "value2"}}'`
22
+- `--json-arg.key1 value1 --json-arg.key2.key3 value2`
23
+
24
+Additionally, list elements can be passed individually using `+`:
25
+
26
+- `--json-arg '{"key4": ["value3", "value4", "value5"]}'`
27
+- `--json-arg.key4+ value3 --json-arg.key4+='value4,value5'`
28
+
29
## serve
30
31
Start the vLLM OpenAI Compatible API server.
docs/configuration/engine_args.md
+10
@@ -11,6 +11,16 @@ Engine arguments control the behavior of the vLLM engine.
11
12
The engine argument classes, [EngineArgs][vllm.engine.arg_utils.EngineArgs] and [AsyncEngineArgs][vllm.engine.arg_utils.AsyncEngineArgs], are a combination of the configuration classes defined in [vllm.config][]. Therefore, if you are interested in developer documentation, we recommend looking at these configuration classes as they are the source of truth for types, defaults and docstrings.
13
14
+When passing JSON CLI arguments, the following sets of arguments are equivalent:
15
+
16
+- `--json-arg '{"key1": "value1", "key2": {"key3": "value2"}}'`
17
+- `--json-arg.key1 value1 --json-arg.key2.key3 value2`
18
+
19
+Additionally, list elements can be passed individually using `+`:
20
+
21
+- `--json-arg '{"key4": ["value3", "value4", "value5"]}'`
22
+- `--json-arg.key4+ value3 --json-arg.key4+='value4,value5'`
23
+
24
## `EngineArgs`
25
26
--8<-- "docs/argparse/engine_args.md"
vllm/engine/arg_utils.py
+2
-21
@@ -178,17 +178,8 @@ def _compute_kwargs(cls: ConfigType) -> dict[str, Any]:
178
kwargs[name] = {"default": default, "help": help}
179
180
# Set other kwargs based on the type hints
181
- json_tip = """Should either be a valid JSON string or JSON keys
182
-passed individually. For example, the following sets of arguments are
183
-equivalent:
184
-
185
-- `--json-arg '{"key1": "value1", "key2": {"key3": "value2"}}'`\n
186
-- `--json-arg.key1 value1 --json-arg.key2.key3 value2`
187
-
188
-Additionally, list elements can be passed individually using `+`:
189
-
190
-- `--json-arg '{"key4": ["value3", "value4", "value5"]}'`\n
191
-- `--json-arg.key4+ value3 --json-arg.key4+='value4,value5'`"""
181
+ json_tip = ("Should either be a valid JSON string or JSON keys passed "
182
+ "individually.")
183
if dataclass_cls is not None:
184
185
def parse_dataclass(val: str, cls=dataclass_cls) -> Any:
@@ -1831,13 +1822,3 @@ def human_readable_int(value):
1822
1823
# Regular plain number.
1824
return int(value)
1834
-
1835
-
1836
-# These functions are used by sphinx to build the documentation
1837
-def _engine_args_parser():
1838
- return EngineArgs.add_cli_args(FlexibleArgumentParser())
1839
-
1840
-
1841
-def _async_engine_args_parser():
1842
- return AsyncEngineArgs.add_cli_args(FlexibleArgumentParser(),
1843
- async_args_only=True)
vllm/utils/__init__.py
+18
-3
@@ -1669,11 +1669,19 @@ class FlexibleArgumentParser(ArgumentParser):
1669
"""ArgumentParser that allows both underscore and dash in names."""
1670
1671
_deprecated: set[Action] = set()
1672
+ _json_tip: str = (
1673
+ "When passing JSON CLI arguments, the following sets of arguments "
1674
+ "are equivalent:\n"
1675
+ ' --json-arg \'{"key1": "value1", "key2": {"key3": "value2"}}\'\n'
1676
+ " --json-arg.key1 value1 --json-arg.key2.key3 value2\n\n"
1677
+ "Additionally, list elements can be passed individually using +:\n"
1678
+ ' --json-arg \'{"key4": ["value3", "value4", "value5"]}\'\n'
1679
+ " --json-arg.key4+ value3 --json-arg.key4+=\'value4,value5\'\n\n")
1680
1681
def __init__(self, *args, **kwargs):
1674
- # Set the default 'formatter_class' to SortedHelpFormatter
1675
- if 'formatter_class' not in kwargs:
1676
- kwargs['formatter_class'] = SortedHelpFormatter
1682
+ # Set the default "formatter_class" to SortedHelpFormatter
1683
+ if "formatter_class" not in kwargs:
1684
+ kwargs["formatter_class"] = SortedHelpFormatter
1685
super().__init__(*args, **kwargs)
1686
1687
if sys.version_info < (3, 13):
@@ -1715,6 +1723,13 @@ class FlexibleArgumentParser(ArgumentParser):
1723
self._action_groups.append(group)
1724
return group
1725
1726
+ def format_help(self) -> str:
1727
+ # Add tip about JSON arguments to the epilog
1728
+ epilog = self.epilog or ""
1729
+ if not epilog.startswith(FlexibleArgumentParser._json_tip):
1730
+ self.epilog = FlexibleArgumentParser._json_tip + epilog
1731
+ return super().format_help()
1732
+
1733
def parse_args( # type: ignore[override]
1734
self,
1735
args: list[str] | None = None,