[Bugfix]: Fix final_res_batch list index out of range error (#21055)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
This commit is contained in:
Chauncey
2025-07-17 15:29:09 +08:00
committed by GitHub
parent c5b8b5953a
commit fdc5b43d20
2 changed files with 78 additions and 40 deletions

View File

@@ -7,6 +7,7 @@ import openai # use the official client for correctness check
import pytest
import pytest_asyncio
import regex as re
import requests
from openai import BadRequestError
from tests.utils import RemoteOpenAIServer
@@ -26,7 +27,8 @@ def default_server_args():
"2048",
"--max-num-seqs",
"128",
"--enforce-eager"
"--enforce-eager",
"--enable-prompt-tokens-details",
]
@@ -679,3 +681,17 @@ async def test_invalid_grammar(client: openai.AsyncOpenAI, model_name: str):
prompt=prompt,
extra_body={"guided_grammar": invalid_simplified_sql_grammar},
)
@pytest.mark.asyncio
async def test_completion_with_empty_prompt_embeds(
client: openai.AsyncOpenAI) -> None:
"""Test completion with empty prompt embeds."""
payload: dict[str, list] = {"prompt_embeds": []}
headers: dict[str, str] = {"Content-Type": "application/json"}
# base_url = http://localhost:8000/v1/completions
response = requests.post(f"{client.base_url}completions",
headers=headers,
json=payload)
assert response.status_code == 200, (
f"Expected status code 200, got {response.status_code}. ")