-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
[Bugfix]: make most of test_openai_schema.py
pass
#17664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
5727d39
to
ad28637
Compare
test_openai_schema.py
pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@router.api_route
isn't recommended. See fastapi/fastapi#7736 (comment)
response_class=Response
fixes errors
___________________________________________________ test_openapi_stateless (verbose_name='POST /ping') ____________________________________________________
@wraps(test)
> def test_function(*args: Any, **kwargs: Any) -> Any:
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:160: in async_run
loop.run_until_complete(future)
/usr/lib/python3.12/asyncio/base_events.py:687: in run_until_complete
return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
case = Case()
@schema.parametrize()
@schema.override(headers={"Content-Type": "application/json"})
async def test_openapi_stateless(case):
#No need to verify SSL certificate for localhost
> await case.call_and_validate(verify=False)
E schemathesis.exceptions.CheckFailed:
E
E 1. Missing Content-Type header
E
E The following media types are documented in the schema:
E - `application/json`
E
E [200] OK:
E
E <EMPTY>
E
E Reproduce with:
E
E curl -X POST --insecure http://localhost:52711/ping
E
E Falsifying example: async_run(
E case=,
E )
tests/entrypoints/openai/test_openai_schema.py:49: CheckFailed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes errors like
___________________________________________________ test_openapi_stateless (verbose_name='GET /health') ___________________________________________________
@wraps(test)
> def test_function(*args: Any, **kwargs: Any) -> Any:
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:160: in async_run
loop.run_until_complete(future)
/usr/lib/python3.12/asyncio/base_events.py:687: in run_until_complete
return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
case = Case()
@schema.parametrize()
@schema.override(headers={"Content-Type": "application/json"})
async def test_openapi_stateless(case):
#No need to verify SSL certificate for localhost
> await case.call_and_validate(verify=False)
E schemathesis.exceptions.CheckFailed:
E
E 1. Missing Content-Type header
E
E The following media types are documented in the schema:
E - `application/json`
E
E [200] OK:
E
E <EMPTY>
E
E Reproduce with:
E
E curl -X GET --insecure http://localhost:52711/health
E
E Falsifying example: async_run(
E case=,
E )
tests/entrypoints/openai/test_openai_schema.py:49: CheckFailed
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We raise a RequestValidationError
so that the existing validation_exception_handler()
will convert it to a JSONResponse
. We need that to happen so we can specify ErrorResponse
as the return type in API endpoints like @router.post("/invocations", ...)
. FastAPI requires return types to be Pydantic types. ErrorResponse
inherits from Pydantic's BaseModel
.
Otherwise fails with errors like
__________________________________________________________________________ test_openapi_stateless (verbose_name='POST /v1/completions') ___________________________________________________________________________
@wraps(test)
> def test_function(*args: Any, **kwargs: Any) -> Any:
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:160: in async_run
loop.run_until_complete(future)
/usr/lib/python3.12/asyncio/base_events.py:687: in run_until_complete
return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
case = Case(body={'prompt': [], 'logprobs': -1})
@schema.parametrize()
@schema.override(headers={"Content-Type": "application/json"})
async def test_openapi_stateless(case):
# No need to verify SSL certificate for localhost
> case.call_and_validate(verify=False)
E schemathesis.exceptions.CheckFailed:
E
E 1. Server error
E
E 2. Undocumented Content-Type
E
E Received: text/plain; charset=utf-8
E Documented: application/json
E
E [500] Internal Server Error:
E
E `Internal Server Error`
E
E Reproduce with:
E
E curl -X POST -H 'Content-Type: application/json' -d '{"prompt": [], "logprobs": -1}' --insecure http://localhost:45731/v1/completions
E
E Falsifying example: async_run(
E case=,
E )
tests/entrypoints/openai/test_openai_schema.py:49: CheckFailed
____________________________________________________________________________ test_openapi_stateless (verbose_name='POST /invocations') ____________________________________________________________________________
@wraps(test)
> def test_function(*args: Any, **kwargs: Any) -> Any:
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:160: in async_run
loop.run_until_complete(future)
/usr/lib/python3.12/asyncio/base_events.py:687: in run_until_complete
return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
case = Case()
@schema.parametrize()
@schema.override(headers={"Content-Type": "application/json"})
async def test_openapi_stateless(case):
# No need to verify SSL certificate for localhost
> case.call_and_validate(verify=False)
E schemathesis.exceptions.CheckFailed:
E
E 1. Response violates schema
E
E 'message' is a required property
E
E Schema:
E
E {
E "properties": {
E "object": {
E "type": "string",
E "title": "Object",
E "default": "error"
E },
E "message": {
E "type": "string",
E "title": "Message"
E },
E "type": {
E "type": "string",
E "title": "Type"
E },
E "param": {
E "anyOf": [
E {
E "type": "string"
E // Output truncated...
E }
E
E Value:
E
E {
E "detail": "Unsupported Media Type: Only 'application/json' is allowed"
E }
E
E [415] Unsupported Media Type:
E
E `{"detail":"Unsupported Media Type: Only 'application/json' is allowed"}`
E
E Reproduce with:
E
E curl -X POST --insecure http://localhost:45731/invocations
E
E Falsifying example: async_run(
E case=,
E )
tests/entrypoints/openai/test_openai_schema.py:49: CheckFailed
613b3f8
to
cba53c0
Compare
fbf4491
to
8f1f856
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes errors like
__________________________________________ test_openapi_stateless (verbose_name='POST /v1/audio/transcriptions') __________________________________________
@wraps(test)
> def test_function(*args: Any, **kwargs: Any) -> Any:
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:160: in async_run
loop.run_until_complete(future)
/usr/lib/python3.12/asyncio/base_events.py:687: in run_until_complete
return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
case = Case(body={'file': Binary(data=b'')})
@schema.parametrize()
@schema.override(headers={"Content-Type": "application/json"})
async def test_openapi_stateless(case):
#No need to verify SSL certificate for localhost
> await case.call_and_validate(verify=False)
E schemathesis.exceptions.CheckFailed:
E
E 1. Undocumented HTTP status code
E
E Received: 400
E Documented: 200, 422
E
E [400] Bad Request:
E
E `{"object":"error","message":"[{'type': 'value_error', 'loc': ('body', 'file'), 'msg': \"Value error, Expected UploadFile, received: <class 'str'>\", 'input': \"b''\", 'ctx': {'error': ValueError(\"Expected UploadFile, received: <class 'str'>\")}}]","type":"BadRequestError","param":null,"code":400}`
E
E Reproduce with:
E
E curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d file=b%27%27 --insecure http://localhost:52711/v1/audio/transcriptions
E
E Falsifying example: async_run(
E case=,
E )
tests/entrypoints/openai/test_openai_schema.py:49: CheckFailed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes errors like
______________________________________________ test_openapi_stateless (verbose_name='POST /v1/completions') _______________________________________________
@wraps(test)
> def test_function(*args: Any, **kwargs: Any) -> Any:
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:160: in async_run
loop.run_until_complete(future)
/usr/lib/python3.12/asyncio/base_events.py:687: in run_until_complete
return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
case = Case(body={'prompt': []})
@schema.parametrize()
@schema.override(headers={"Content-Type": "application/json"})
async def test_openapi_stateless(case):
#No need to verify SSL certificate for localhost
> await case.call_and_validate(verify=False)
E schemathesis.exceptions.CheckFailed:
E
E 1. Undocumented HTTP status code
E
E Received: 400
E Documented: 200, 422
E
E [400] Bad Request:
E
E `{"object":"error","message":"please provide at least one prompt","type":"BadRequestError","param":null,"code":400}`
E
E Reproduce with:
E
E curl -X POST -H 'Content-Type: application/json' -d '{"prompt": []}' --insecure http://localhost:52711/v1/completions
E
E Falsifying example: async_run(
E case=,
E )
tests/entrypoints/openai/test_openai_schema.py:49: CheckFailed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes errors like
____________________________________________ test_openapi_stateless (verbose_name='POST /v1/chat/completions') ____________________________________________
@wraps(test)
> def test_function(*args: Any, **kwargs: Any) -> Any:
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:160: in async_run
loop.run_until_complete(future)
/usr/lib/python3.12/asyncio/base_events.py:687: in run_until_complete
return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
case = Case(body={'messages': []})
@schema.parametrize()
@schema.override(headers={"Content-Type": "application/json"})
async def test_openapi_stateless(case):
#No need to verify SSL certificate for localhost
> await case.call_and_validate(verify=False)
E schemathesis.exceptions.CheckFailed:
E
E 1. Undocumented HTTP status code
E
E Received: 400
E Documented: 200, 422
E
E [400] Bad Request:
E
E `{"object":"error","message":"","type":"BadRequestError","param":null,"code":400}`
E
E Reproduce with:
E
E curl -X POST -H 'Content-Type: application/json' -d '{"messages": []}' --insecure http://localhost:52711/v1/chat/completions
E
E Falsifying example: async_run(
E case=,
E )
tests/entrypoints/openai/test_openai_schema.py:49: CheckFailed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes errors like
_________________________________________________ test_openapi_stateless (verbose_name='POST /tokenize') __________________________________________________
@wraps(test)
> def test_function(*args: Any, **kwargs: Any) -> Any:
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:160: in async_run
loop.run_until_complete(future)
/usr/lib/python3.12/asyncio/base_events.py:687: in run_until_complete
return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
case = Case(body={'messages': []})
@schema.parametrize()
@schema.override(headers={"Content-Type": "application/json"})
async def test_openapi_stateless(case):
#No need to verify SSL certificate for localhost
> await case.call_and_validate(verify=False)
E schemathesis.exceptions.CheckFailed:
E
E 1. Undocumented HTTP status code
E
E Received: 400
E Documented: 200, 422
E
E [400] Bad Request:
E
E `{"object":"error","message":"","type":"BadRequestError","param":null,"code":400}`
E
E Reproduce with:
E
E curl -X POST -H 'Content-Type: application/json' -d '{"messages": []}' --insecure http://localhost:52711/tokenize
E
E Falsifying example: async_run(
E case=,
E )
tests/entrypoints/openai/test_openai_schema.py:49: CheckFailed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed to test expecting Content-Type: application/json
all the time. See https://fastapi.tiangolo.com/advanced/additional-responses/#additional-media-types-for-the-main-response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to return a Response
since there's no JSON payload to return
All the requests that receive unexpected 500 responses documented in #17038 now receive 400. I think this PR now fixes that issue.
```
$ curl -X POST -H 'Content-Type: application/json' -d '{"messages": []}' --insecure http://127.0.0.1:8000/tokenize -v
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 127.0.0.1:8000...
* Connected to 127.0.0.1 (127.0.0.1) port 8000
> POST /tokenize HTTP/1.1
> Host: 127.0.0.1:8000
> User-Agent: curl/8.5.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 16
>
< HTTP/1.1 400 Bad Request
< date: Mon, 12 May 2025 12:54:20 GMT
< server: uvicorn
< content-length: 104
< content-type: application/json
<
* Connection #0 to host 127.0.0.1 left intact
{"object":"error","message":" list index out of range","type":"BadRequestError","param":null,"code":400}
$ curl -X POST -H 'Content-Type: application/json' -d '{"tokens": [-1]}' --insecure http://127.0.0.1:8000/detokenize -v
< HTTP/1.1 400 Bad Request
$ curl -X POST -H 'Content-Type: application/json' -d '{"messages": []}' --insecure http://127.0.0.1:8000/v1/chat/completions -v
< HTTP/1.1 400 Bad Request
$ curl -X POST -H 'Content-Type: application/json' -d '{"prompt": [-1]}' --insecure http://127.0.0.1:8000/v1/completions -v
< HTTP/1.1 400 Bad Request
$ curl -X POST -H 'Content-Type: application/json' --insecure http://127.0.0.1:8000/invocations -v
< HTTP/1.1 400 Bad Request
|
Shouldn't they recieve 422? That's what the linked issue seems to suggest |
I actually just replaced almost all the |
The error in that issue is saying that only 200 and 422 are documented. I've added more expected codes like 400. HTTP 422 specifically points to semantic or validation errors with the request payload, HTTP 400 broadly indicates issues with the request syntax or structure. Happy to change to whatever makes more sense. lmk! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to fix errors like the below where the FastAPI middleware returns an error before our custom endpoint function runs. We need to return a payload that has the schema of ErrorResponse
because we document that as the return type in our endpoints.
______________________________________________________________ test_openapi_stateless (verbose_name='POST /v1/audio/transcriptions') ______________________________________________________________
@wraps(test)
> def test_function(*args: Any, **kwargs: Any) -> Any:
.venv/lib/python3.12/site-packages/schemathesis/_hypothesis.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
case = Case(body={'file': Binary(data=b'')})
@schema.parametrize()
@schema.override(headers={"Content-Type": "application/json"})
def test_openapi_stateless(case: schemathesis.Case):
key = (
case.operation.method.upper(),
case.operation.path,
)
timeout = {
("POST", "/v1/chat/completions"): 99999,
}.get(key, 10)
#No need to verify SSL certificate for localhost
> case.call_and_validate(verify=False, timeout=timeout)
E schemathesis.exceptions.CheckFailed:
E
E 1. Response violates schema
E
E 'message' is a required property
E
E Schema:
E
E {
E "properties": {
E "object": {
E "type": "string",
E "title": "Object",
E "default": "error"
E },
E "message": {
E "type": "string",
E "title": "Message"
E },
E "type": {
E "type": "string",
E "title": "Type"
E },
E "param": {
E "anyOf": [
E {
E "type": "string"
E // Output truncated...
E }
E
E Value:
E
E {
E "detail": "Expected 'file' to be a file-like object, not 'str'."
E }
E
E [422] Unprocessable Entity:
E
E `{"detail":"Expected 'file' to be a file-like object, not 'str'."}`
E
E Reproduce with:
E
E curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d file=b%27%27 --insecure http://localhost:36871/v1/audio/transcriptions
E
E Falsifying example: test_openapi_stateless(
E case=,
E )
tests/entrypoints/openai/test_openai_schema.py:57: CheckFailed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an exceptionally well documented PR!
I only have one tiny nit about including some of the context you provided on GitHub into code comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hmellor thank you. I updated the PR description after rebasing. Ready for another review. 🙏
test_openai_schema.py
passtest_openai_schema.py
pass
The only test that consistently fails for me now is vllm/vllm/entrypoints/chat_utils.py Line 1083 in 98ea356
part_type is "file" .
$ curl -X POST -H 'Content-Type: application/json' -d '{"messages": [{"content": [{"file": {}, "type": "file"}], "role": "user"}]}' --insecure http://localhost:8000/tokenize -v
Note: Unnecessary use of -X or --request, POST is already inferred.
* Host localhost:8000 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
* Trying [::1]:8000...
* connect to ::1 port 8000 from ::1 port 40420 failed: Connection refused
* Trying 127.0.0.1:8000...
* Connected to localhost (127.0.0.1) port 8000
> POST /tokenize HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/8.5.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 75
>
< HTTP/1.1 500 Internal Server Error
< date: Mon, 12 May 2025 17:32:11 GMT
< server: uvicorn
< content-length: 109
< content-type: application/json
<
* Connection #0 to host localhost left intact
{"object":"error","message":"Unknown part type: file","type":"Internal Server Error","param":null,"code":500} |
This is ready for review 🙏 |
This change makes most of the parameterized tests in `pytest tests/entrypoints/openai/test_openai_schema.py` pass. We handle user input errors, enrich HTTP error messages with more information, and update the error response definitions for several API endpoints. The remaining tests that fail are `POST /tokenize` and maybe `POST /v1/chat/completions`. FIX vllm-project#17037 FIX vllm-project#17038 Signed-off-by: David Xia <[email protected]>
I rebased on main and updated We can discuss how to make the test case pass in a follow-up PR and then enabling the overall test by removing the |
I created a follow-up issue #18162. |
Signed-off-by: Yuqi Zhang <[email protected]>
This change makes most of the parameterized tests in
pytest tests/entrypoints/openai/test_openai_schema.py
pass. We handle user input errors, enrich HTTP error messages with more information, and update the error response definitions for several API endpoints.The remaining tests that fail are
POST /tokenize
and maybePOST /v1/chat/completions
.FIX #17037
FIX #17038
test results before
test results after
1. POST /tokenize
before
after
2. POST /detokenize
before
after
3. POST /v1/chat/completions
before
after
4. POST /v1/completions
before
after
5. POST /v1/audio/transcriptions
before
after
6. POST /invocations
before
after