[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
@@ -5,6 +5,7 @@ from typing import Any
|
||||
|
||||
import pytest
|
||||
from fastapi import FastAPI
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from vllm.entrypoints.generate.structured_decisions.api_router import (
|
||||
register_structured_decisions_api_router,
|
||||
@@ -16,6 +17,9 @@ from vllm.entrypoints.generate.structured_decisions.strategies import (
|
||||
reply_label_ids,
|
||||
select_read_strategy,
|
||||
)
|
||||
from vllm.entrypoints.serve.exception_handling.register import (
|
||||
init_exception_handler,
|
||||
)
|
||||
|
||||
|
||||
def model(architecture: str, logprobs_mode: str = "raw_logprobs") -> Any:
|
||||
@@ -32,13 +36,30 @@ def test_strategy_selection():
|
||||
select_read_strategy(model(qwen, "raw_logits"))
|
||||
|
||||
|
||||
def test_route_needs_the_flag():
|
||||
for enabled in (False, True):
|
||||
app = FastAPI()
|
||||
app.state.args = SimpleNamespace(enable_structured_decisions=enabled)
|
||||
register_structured_decisions_api_router(app)
|
||||
paths = {getattr(route, "path", None) for route in app.routes}
|
||||
assert ("/v1/systemone" in paths) == enabled
|
||||
def test_route_is_registered_by_default():
|
||||
app = FastAPI()
|
||||
register_structured_decisions_api_router(app)
|
||||
paths = {getattr(route, "path", None) for route in app.routes}
|
||||
assert "/v1/systemone" in paths
|
||||
|
||||
|
||||
def test_unsupported_model_returns_501():
|
||||
app = FastAPI()
|
||||
app.state.args = SimpleNamespace(log_error_stack=False)
|
||||
app.state.serving_structured_decisions = None
|
||||
init_exception_handler(app)
|
||||
register_structured_decisions_api_router(app)
|
||||
|
||||
with TestClient(app) as client:
|
||||
response = client.post(
|
||||
"/v1/systemone",
|
||||
json={
|
||||
"model": "unsupported",
|
||||
"state": "x",
|
||||
"questions": {"answer": {"type": "choice", "criteria": {"yes": None}}},
|
||||
},
|
||||
)
|
||||
assert response.status_code == 501
|
||||
|
||||
|
||||
def test_structured_state_keeps_unicode_in_prompt():
|
||||
|
||||
@@ -19,7 +19,6 @@ def server():
|
||||
"--max-num-seqs",
|
||||
"32",
|
||||
"--enable-prefix-caching",
|
||||
"--enable-structured-decisions",
|
||||
]
|
||||
with RemoteOpenAIServer(MODEL_NAME, args) as remote_server:
|
||||
yield remote_server
|
||||
|
||||
Reference in New Issue
Block a user