[Frontend] Expose /v1/systemone without an opt-in flag (#60677)
Signed-off-by: Francisco Javier Arceo <4163062+franciscojavierarceo@users.noreply.github.com> Co-authored-by: Codex <noreply@openai.com> Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>
This commit is contained in:
co-authored by
Codex
Cyrus Leung
parent
72d59adc2c
commit
ae9adec905
@@ -230,16 +230,11 @@ async def init_generate_state(
|
||||
from .structured_decisions.serving import ServingStructuredDecisions
|
||||
from .structured_decisions.strategies import ReadContext, select_read_strategy
|
||||
|
||||
strategy_cls = (
|
||||
select_read_strategy(engine_client.model_config)
|
||||
if "generate" in supported_tasks
|
||||
and getattr(args, "enable_structured_decisions", False)
|
||||
else None
|
||||
)
|
||||
state.serving_structured_decisions = (
|
||||
ServingStructuredDecisions(
|
||||
state.openai_serving_models,
|
||||
strategy_cls(
|
||||
strategy = None
|
||||
if "generate" in supported_tasks:
|
||||
try:
|
||||
strategy_cls = select_read_strategy(engine_client.model_config)
|
||||
strategy = strategy_cls(
|
||||
ReadContext(
|
||||
engine_client=engine_client,
|
||||
online_renderer=state.online_renderer,
|
||||
@@ -247,9 +242,15 @@ async def init_generate_state(
|
||||
chat_template_content_format=args.chat_template_content_format,
|
||||
default_chat_template_kwargs=default_chat_template_kwargs,
|
||||
)
|
||||
),
|
||||
)
|
||||
except ValueError:
|
||||
strategy = None
|
||||
state.serving_structured_decisions = (
|
||||
ServingStructuredDecisions(
|
||||
state.openai_serving_models,
|
||||
strategy,
|
||||
request_logger=request_logger,
|
||||
)
|
||||
if strategy_cls is not None
|
||||
if strategy is not None
|
||||
else None
|
||||
)
|
||||
|
||||
@@ -49,5 +49,4 @@ async def create_structured_decision(
|
||||
|
||||
|
||||
def register_structured_decisions_api_router(app: FastAPI):
|
||||
if getattr(app.state.args, "enable_structured_decisions", False):
|
||||
app.include_router(router)
|
||||
app.include_router(router)
|
||||
|
||||
@@ -219,17 +219,16 @@ LOGPROBS_MODES = frozenset({"raw_logprobs", "processed_logprobs"})
|
||||
|
||||
|
||||
def select_read_strategy(model_config: ModelConfig) -> type[ReadStrategy]:
|
||||
"""Raises ValueError when the model cannot serve structured decisions. The
|
||||
server opted in with --enable-structured-decisions, so startup fails."""
|
||||
"""Raise ValueError when the model cannot serve structured decisions."""
|
||||
if model_config.architecture not in NEXT_TOKEN_ARCHITECTURES:
|
||||
raise ValueError(
|
||||
"--enable-structured-decisions does not support "
|
||||
"The structured decisions API does not support "
|
||||
f"{model_config.architecture}. Supported architectures: "
|
||||
f"{sorted(NEXT_TOKEN_ARCHITECTURES)}"
|
||||
)
|
||||
if model_config.logprobs_mode not in LOGPROBS_MODES:
|
||||
raise ValueError(
|
||||
"--enable-structured-decisions needs --logprobs-mode raw_logprobs or "
|
||||
"Structured decisions need --logprobs-mode raw_logprobs or "
|
||||
f"processed_logprobs, not {model_config.logprobs_mode}"
|
||||
)
|
||||
return NextTokenStrategy
|
||||
|
||||
@@ -163,8 +163,6 @@ class BaseFrontendArgs:
|
||||
enable_tokenizer_info_endpoint: bool = False
|
||||
"""Enable the `/tokenizer_info` endpoint. May expose chat
|
||||
templates and other tokenizer configuration."""
|
||||
enable_structured_decisions: bool = False
|
||||
"""Enable the `/v1/systemone` structured decisions endpoint."""
|
||||
enable_log_outputs: bool = False
|
||||
"""If set to True, log model outputs (generations). Requires
|
||||
`--enable-log-requests`. Output text and finish reasons are logged at INFO,
|
||||
|
||||
Reference in New Issue
Block a user