Files
vllm-omni/vllm_omni/entrypoints/openai/duplex_capability.py
T
05b794f29b [Full Duplex] Feat: Support Full-Duplex realtime runtime & add MiniCPM-o 4.5 demo (#3907)
Signed-off-by: Sy03 <1370724210@qq.com>
Signed-off-by: lishunyang12 <lishunyang03@gmail.com>
Signed-off-by: Yueqian Lin <linyueqian@outlook.com>
Co-authored-by: lishunyang12 <lishunyang03@gmail.com>
Co-authored-by: Yueqian Lin <linyueqian@outlook.com>
Co-authored-by: StormMelody <22371184@zju.edu.cn>
Co-authored-by: Gao Han <hgaoaf@connect.ust.hk>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
2026-07-23 16:45:18 +08:00

36 lines
1.1 KiB
Python

# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from vllm.logger import init_logger
logger = init_logger(__name__)
def should_enable_duplex_endpoint(
stage_configs: list | None,
*,
config_path: str | None = None,
) -> bool:
"""Enable duplex routes only for deployments that explicitly opt in."""
if stage_configs:
for stage in stage_configs:
session_mode = (
stage.get("session_mode") if isinstance(stage, dict) else getattr(stage, "session_mode", None)
)
if session_mode == "duplex":
return True
if config_path:
try:
from omegaconf import OmegaConf
raw_config = OmegaConf.load(config_path)
session_mode = raw_config.get("session_mode") if hasattr(raw_config, "get") else None
if session_mode == "duplex":
return True
except Exception as exc:
logger.warning("Failed to inspect duplex session_mode from %s: %s", config_path, exc)
return False
__all__ = ["should_enable_duplex_endpoint"]