From 39bfb57b7c89c2ae64d7d9b895e94c05ea9e965c Mon Sep 17 00:00:00 2001 From: Harry Mellor <19981378+hmellor@users.noreply.github.com> Date: Wed, 18 Mar 2026 17:19:35 +0000 Subject: [PATCH] Add API docs link if the CLI arg is a config class (#37432) Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> --- vllm/engine/arg_utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vllm/engine/arg_utils.py b/vllm/engine/arg_utils.py index d0bdd4916..730641a18 100644 --- a/vllm/engine/arg_utils.py +++ b/vllm/engine/arg_utils.py @@ -108,6 +108,7 @@ from vllm.utils.network_utils import get_ip from vllm.utils.torch_utils import resolve_kv_cache_dtype_string from vllm.v1.attention.backends.registry import AttentionBackendEnum from vllm.v1.sample.logits_processor import LogitsProcessor +from vllm.version import __version__ as VLLM_VERSION if TYPE_CHECKING: from vllm.model_executor.layers.quantization import QuantizationMethods @@ -243,6 +244,14 @@ NEEDS_HELP = ( ) +def _maybe_add_docs_url(cls: Any) -> str: + """Generate API docs URL for a vllm config class.""" + if not cls.__module__.startswith("vllm.config"): + return "" + version = f"v{VLLM_VERSION}" if "dev" not in VLLM_VERSION else "latest" + return f"\n\nAPI docs: https://docs.vllm.ai/en/{version}/api/vllm/config/#vllm.config.{cls.__name__}" + + @functools.lru_cache(maxsize=30) def _compute_kwargs(cls: ConfigType) -> dict[str, dict[str, Any]]: # Save time only getting attr docs if we're generating help text @@ -293,6 +302,7 @@ def _compute_kwargs(cls: ConfigType) -> dict[str, dict[str, Any]]: raise argparse.ArgumentTypeError(repr(e)) from e kwargs[name]["type"] = parse_dataclass + kwargs[name]["help"] += _maybe_add_docs_url(dataclass_cls) kwargs[name]["help"] += f"\n\n{json_tip}" elif contains_type(type_hints, bool): # Creates --no- and -- flags