[Core / Bugfix] Add Mechanism for Endpoint Rejection (#4762)
Signed-off-by: Alex Brooks <albrooks@redhat.com>
This commit is contained in:
1 parent
7d4decc1d8
commit
b7d08fe5f6
14 files changed
+508
-158
No files matched your search
@@ -148,6 +148,7 @@ class AsyncOmni(EngineClient, OmniBase):
|
||||
self.config_path = self.engine.config_path
|
||||
self.tts_max_instructions_length = kwargs.get("tts_max_instructions_length", None)
|
||||
self.input_processor = self.engine.input_processor
|
||||
self.endpoint_restrictions = self.engine.endpoint_restrictions
|
||||
|
||||
stage_index = self._get_comprehension_stage_index()
|
||||
if stage_index is None:
|
||||
|
||||
@@ -91,6 +91,7 @@ from vllm.utils import random_uuid
|
||||
from vllm.utils.system_utils import decorate_logs
|
||||
from vllm.v1.engine.exceptions import EngineDeadError, EngineGenerateError
|
||||
|
||||
from vllm_omni.config.endpoint_policy import shutdown_unsupported_routes
|
||||
from vllm_omni.diffusion.models.interface import ReferenceVideoDecodeSpec
|
||||
from vllm_omni.entrypoints.async_omni import AsyncOmni
|
||||
from vllm_omni.entrypoints.openai.errors import InvalidInputReferenceError
|
||||
@@ -259,7 +260,7 @@ async def _get_vllm_config(engine_client: EngineClient) -> Any:
|
||||
return getattr(engine_client, "vllm_config", None)
|
||||
|
||||
|
||||
def _remove_route_from_app(app, path: str, methods: set[str] | None = None):
|
||||
def _remove_route_from_app(app, path: str, methods: frozenset[str] | None = None):
|
||||
"""Remove a route from the app by path and optionally by methods.
|
||||
|
||||
OMNI: used to override upstream /v1/chat/completions with omni behavior.
|
||||
@@ -509,6 +510,12 @@ async def omni_run_server_worker(listen_address, sock, args, client_config=None,
|
||||
|
||||
await omni_init_app_state(engine_client, app.state, args)
|
||||
|
||||
# After initializing the app state, shut down any endpoints that are model specific
|
||||
if hasattr(engine_client, "endpoint_restrictions"):
|
||||
shutdown_unsupported_routes(app, engine_client.endpoint_restrictions)
|
||||
else:
|
||||
logger.warning("engine client has no endpoint restrictions attribute")
|
||||
|
||||
# Start background processes
|
||||
await STORAGE_MANAGER.start()
|
||||
|
||||
|
||||
@@ -345,6 +345,7 @@ def load_stage_configs_from_model(
|
||||
|
||||
stages = StageConfigFactory.create_from_model(
|
||||
model,
|
||||
trust_remote_code=cli_overrides.get("trust_remote_code", False),
|
||||
cli_overrides=cli_overrides,
|
||||
deploy_config_path=deploy_config_path,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user