Skip to content

Commit

Permalink
[Misc] Add argument to disable FastAPI docs (vllm-project#8554)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffwan authored and MengqingCao committed Sep 30, 2024
1 parent d5709a0 commit 38b8514
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion vllm/entrypoints/openai/api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,13 @@ async def unload_lora_adapter(request: UnloadLoraAdapterRequest,


def build_app(args: Namespace) -> FastAPI:
app = FastAPI(lifespan=lifespan)
if args.disable_fastapi_docs:
app = FastAPI(openapi_url=None,
docs_url=None,
redoc_url=None,
lifespan=lifespan)
else:
app = FastAPI(lifespan=lifespan)
app.include_router(router)
app.root_path = args.root_path

Expand Down
7 changes: 7 additions & 0 deletions vllm/entrypoints/openai/cli_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ def make_arg_parser(parser: FlexibleArgumentParser) -> FlexibleArgumentParser:
'ID numbers being printed in log.'
'\n\nDefault: Unlimited')

parser.add_argument(
"--disable-fastapi-docs",
action='store_true',
default=False,
help="Disable FastAPI's OpenAPI schema, Swagger UI, and ReDoc endpoint"
)

return parser


Expand Down

0 comments on commit 38b8514

Please sign in to comment.