Skip to content

Commit 6c3f402

Browse files
authored
chore: Use choices in CLI (#48)
Signed-off-by: Ce Gao <cegao@tensorchord.ai>
1 parent 6c96990 commit 6c3f402

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/vllm_router/router.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,6 @@ async def health() -> Response:
192192

193193

194194
def validate_args(args):
195-
if args.service_discovery not in ["static", "k8s"]:
196-
raise ValueError(f"Invalid service discovery type: {args.service_discovery}")
197-
198195
if args.service_discovery == "static":
199196
if args.static_backends is None:
200197
raise ValueError(
@@ -205,9 +202,6 @@ def validate_args(args):
205202
"Static models must be provided when using static service discovery."
206203
)
207204

208-
if args.routing_logic not in ["roundrobin", "session"]:
209-
raise ValueError(f"Invalid routing logic: {args.routing_logic}")
210-
211205
if args.service_discovery == "static" and args.static_backends is None:
212206
raise ValueError(
213207
"Static backends must be provided when using static service discovery."
@@ -235,7 +229,8 @@ def parse_args():
235229
parser.add_argument(
236230
"--service-discovery",
237231
required=True,
238-
help="The service discovery type. Options: static, k8s",
232+
choices=["static", "k8s"],
233+
help="The service discovery type.",
239234
)
240235
parser.add_argument(
241236
"--static-backends",
@@ -274,7 +269,8 @@ def parse_args():
274269
"--routing-logic",
275270
type=str,
276271
required=True,
277-
help="The routing logic to use, Options: roundrobin, session",
272+
choices=["roundrobin", "session"],
273+
help="The routing logic to use",
278274
)
279275
parser.add_argument(
280276
"--session-key",

0 commit comments

Comments
 (0)