@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / e0d6b4a867
Fork 0

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 13, 15:45 UTC

[CLI] add --max-tokens to `vllm complete` (#28109)

Signed-off-by: Iceber Gu <caiwei95@hotmail.com>

Iceber Gu committed Nov 7, 2025 at 20:21 UTC e0d6b4a867bd53edb33496756913c30480029ba8
1 file changed +14 -6
vllm/entrypoints/cli/openai.py
+14 -6
@@ -195,10 +195,15 @@ class CompleteCommand(CLISubcommand):
195 def cmd(args: argparse.Namespace) -> None:
196 model_name, client = _interactive_cli(args)
197
198 + kwargs = {
199 + "model": model_name,
200 + "stream": True,
201 + }
202 + if args.max_tokens:
203 + kwargs["max_tokens"] = args.max_tokens
204 +
205 if args.quick:
199 - stream = client.completions.create(
200 - model=model_name, prompt=args.quick, stream=True
201 - )
206 + stream = client.completions.create(prompt=args.quick, **kwargs)
207 _print_completion_stream(stream)
208 return
209
@@ -208,15 +213,18 @@ class CompleteCommand(CLISubcommand):
213 input_prompt = input("> ")
214 except EOFError:
215 break
211 - stream = client.completions.create(
212 - model=model_name, prompt=input_prompt, stream=True
213 - )
216 + stream = client.completions.create(prompt=input_prompt, **kwargs)
217 _print_completion_stream(stream)
218
219 @staticmethod
220 def add_cli_args(parser: FlexibleArgumentParser) -> FlexibleArgumentParser:
221 """Add CLI arguments for the complete command."""
222 _add_query_options(parser)
223 + parser.add_argument(
224 + "--max-tokens",
225 + type=int,
226 + help="Maximum number of tokens to generate per output sequence.",
227 + )
228 parser.add_argument(
229 "-q",
230 "--quick",