-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Add property-based testing for vLLM endpoints using an API defined by an OpenAPI 3.1 schema #16721
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8ffbdc8
Add tests for openai schema testing
tarukumar a1ae7db
fix precommit
tarukumar d459a34
replace model
tarukumar a2ceea6
apply header to all genereted tc from schema
tarukumar 9703dd5
ignore
tarukumar 93e58fa
Merge branch 'main' into test-openai
tarukumar 59ea0f3
[V1][Perf] Faster incremental detokenization (#15137)
njhill 779db30
[V1][Perf] Faster incremental detokenization (#15137)
njhill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import pytest | ||
import schemathesis | ||
from schemathesis import GenerationConfig | ||
|
||
from ...utils import RemoteOpenAIServer | ||
|
||
schemathesis.experimental.OPEN_API_3_1.enable() | ||
|
||
MODEL_NAME = "HuggingFaceTB/SmolVLM-256M-Instruct" | ||
MAXIMUM_IMAGES = 2 | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def server(): | ||
args = [ | ||
"--task", | ||
"generate", | ||
"--max-model-len", | ||
"2048", | ||
"--max-num-seqs", | ||
"5", | ||
"--enforce-eager", | ||
"--trust-remote-code", | ||
"--limit-mm-per-prompt", | ||
f"image={MAXIMUM_IMAGES}", | ||
] | ||
|
||
with RemoteOpenAIServer(MODEL_NAME, args) as remote_server: | ||
yield remote_server | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def get_schema(server): | ||
# avoid generating null (\x00) bytes in strings during test case generation | ||
return schemathesis.openapi.from_uri( | ||
f"{server.url_root}/openapi.json", | ||
generation_config=GenerationConfig(allow_x00=False), | ||
) | ||
|
||
|
||
schema = schemathesis.from_pytest_fixture("get_schema") | ||
|
||
|
||
@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) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.