diff --git a/README.md b/README.md index 37b8141751..79bfc4fdf4 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ Its core features include: ## Getting Started - [Install SGLang](https://docs.sglang.io/get_started/install.html) - [Quick Start](https://docs.sglang.io/basic_usage/send_request.html) +- [Cookbook](https://docs.sglang.io/cookbook) — the deployment command we recommend for each supported model - [Backend Tutorial](https://docs.sglang.io/basic_usage/openai_api_completions.html) - [Frontend Tutorial](https://docs.sglang.io/references/frontend/frontend_tutorial.html) - [Contribution Guide](https://docs.sglang.io/developer_guide/contribution_guide.html) diff --git a/python/pyproject.toml b/python/pyproject.toml index 1ac9846e1a..0f5c947b2c 100755 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -205,6 +205,8 @@ vsa = ["setuptools", "torch"] [project.urls] "Homepage" = "https://github.com/sgl-project/sglang" +"Documentation" = "https://docs.sglang.io" +"Cookbook" = "https://docs.sglang.io/cookbook" "Bug Tracker" = "https://github.com/sgl-project/sglang/issues" [project.scripts] diff --git a/python/sglang/cli/generate.py b/python/sglang/cli/generate.py index 56ae1ddfe3..43efa7bcd0 100644 --- a/python/sglang/cli/generate.py +++ b/python/sglang/cli/generate.py @@ -1,5 +1,6 @@ import argparse +from sglang.cli.main import COOKBOOK_EPILOG from sglang.cli.utils import get_is_diffusion_model, get_model_path @@ -10,7 +11,11 @@ def generate(args, extra_argv): add_multimodal_gen_generate_args, ) - parser = argparse.ArgumentParser(description="SGLang Multimodal Generation") + parser = argparse.ArgumentParser( + description="SGLang Multimodal Generation", + epilog=COOKBOOK_EPILOG, + formatter_class=argparse.RawDescriptionHelpFormatter, + ) add_multimodal_gen_generate_args(parser) parser.parse_args(extra_argv) return diff --git a/python/sglang/cli/main.py b/python/sglang/cli/main.py index 3cfef9cb71..b8cbbc9f03 100644 --- a/python/sglang/cli/main.py +++ b/python/sglang/cli/main.py @@ -9,8 +9,19 @@ def version(args, extra_argv): print(f"git revision: {get_git_commit_hash()[:7]}") +COOKBOOK_URL = "https://docs.sglang.io/cookbook" +COOKBOOK_EPILOG = ( + f"Deploying a specific model? Its cookbook page at {COOKBOOK_URL} carries the " + "recommended command for it: GPU count, parallelism, quantization and the " + "flags that matter for that model." +) + + def main(): - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser( + epilog=COOKBOOK_EPILOG, + formatter_class=argparse.RawDescriptionHelpFormatter, + ) # complex sub commands subparsers = parser.add_subparsers(dest="subcommand", required=True) diff --git a/python/sglang/cli/serve.py b/python/sglang/cli/serve.py index 516e7a693a..a66522e1aa 100644 --- a/python/sglang/cli/serve.py +++ b/python/sglang/cli/serve.py @@ -4,6 +4,7 @@ import argparse import logging import os +from sglang.cli.main import COOKBOOK_EPILOG from sglang.cli.serve_backends import ( SERVE_BACKEND_API_VERSION, ServeBackend, @@ -186,6 +187,9 @@ def serve(args, extra_argv): _print_general_help(registry) else: registry.get(backend_name).backend.run(request) + # Printed here rather than as a backend parser's epilog so it appears + # exactly once, after whichever backend help ran. + print(f"\n{COOKBOOK_EPILOG}") return from sglang.srt.plugins import load_plugins