[Frontend] Switch Python Harmony dependency to oss-harmony (#55128)

Signed-off-by: Anton Peganov <apeganov@nvidia.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
Anton Peganov
2026-09-28 00:43:56 +04:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> OpenAI Codex
parent 386ac2573e
commit 73859fec58
17 changed files with 265 additions and 56 deletions
@@ -20,6 +20,7 @@ Each test:
"""
from openai.types.responses import ResponseFunctionToolCall
from openai_harmony import Message, Role
from tests.entrypoints.openai.utils import verify_harmony_messages
from vllm.entrypoints.openai.parser.harmony_utils import (
@@ -33,6 +34,23 @@ from vllm.entrypoints.openai.responses.harmony import (
response_previous_input_to_harmony,
)
def test_render_uses_legacy_tool_call_header():
tool_call = (
Message.from_role_and_content(Role.ASSISTANT, "print('hello')")
.with_channel("commentary")
.with_recipient("python")
.with_content_type("code")
)
rendered = get_encoding().decode(render_for_completion([tool_call]))
assert (
"<|start|>assistant to=python<|channel|>commentary code<|message|>" in rendered
)
assert "commentary to=python <|constrain|>code" not in rendered
# Use a fixed date so the system message is deterministic across both paths.
_DATE = "2025-01-01"
+34
View File
@@ -0,0 +1,34 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Run the gpt-oss GPQA evaluator with an explicit output-token budget."""
import argparse
from gpt_oss.evals.gpqa_eval import GPQAEval
from gpt_oss.evals.responses_sampler import ResponsesSampler
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--model", required=True)
parser.add_argument("--reasoning-effort", required=True)
parser.add_argument("--base-url", required=True)
parser.add_argument("--n-threads", required=True, type=int)
parser.add_argument("--max-output-tokens", required=True, type=int)
args = parser.parse_args()
sampler = ResponsesSampler(
model=args.model,
reasoning_model=True,
reasoning_effort=args.reasoning_effort,
base_url=args.base_url,
max_tokens=args.max_output_tokens,
)
result = GPQAEval(n_repeats=8, n_threads=args.n_threads)(sampler)
# gpt-oss returns a NumPy scalar. Convert it so the parent process gets a
# stable, dependency-independent representation that its regex can parse.
print({"metric": float(result.score)})
if __name__ == "__main__":
main()
+9 -4
View File
@@ -21,6 +21,12 @@ from tests.utils import RemoteOpenAIServer
TOL = 0.05 # Absolute tolerance for accuracy comparison
# gpt-oss >= 0.0.7 explicitly sends its 131072-token default as the output
# budget, which leaves no room for the prompt in GPT-OSS's 131072-token context.
# This test originally ran with a 32768-token model context, so retain that
# proven generation budget while using the current evaluator package.
MAX_OUTPUT_TOKENS = 32_768
# Path to tiktoken encoding files
TIKTOKEN_DATA_DIR = Path(__file__).parent / "data"
@@ -50,10 +56,7 @@ def run_gpqa_eval(model_name: str, base_url: str, reasoning_effort: str) -> floa
# Build the command to run the evaluation
cmd = [
sys.executable,
"-m",
"gpt_oss.evals",
"--eval",
"gpqa",
str(Path(__file__).with_name("run_gpqa_eval.py")),
"--model",
model_name,
"--reasoning-effort",
@@ -62,6 +65,8 @@ def run_gpqa_eval(model_name: str, base_url: str, reasoning_effort: str) -> floa
base_url,
"--n-threads",
"200",
"--max-output-tokens",
str(MAX_OUTPUT_TOKENS),
]
try: