Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
5e021b49
Unverified
Commit
5e021b49
authored
Aug 24, 2025
by
TeeKen Lau
Committed by
GitHub
Aug 24, 2025
Browse files
(Misc): add missing test for zero truncation size. (#23457)
Signed-off-by:
teekenl
<
teekenlau@gmail.com
>
parent
1b9b1664
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
tests/entrypoints/openai/test_truncation.py
tests/entrypoints/openai/test_truncation.py
+22
-0
No files found.
tests/entrypoints/openai/test_truncation.py
View file @
5e021b49
...
@@ -64,6 +64,28 @@ async def test_smaller_truncation_size(client: openai.AsyncOpenAI):
...
@@ -64,6 +64,28 @@ async def test_smaller_truncation_size(client: openai.AsyncOpenAI):
assert
response
[
"usage"
][
"prompt_tokens"
]
==
truncation_size
assert
response
[
"usage"
][
"prompt_tokens"
]
==
truncation_size
@
pytest
.
mark
.
asyncio
async
def
test_zero_truncation_size
(
client
:
openai
.
AsyncOpenAI
):
truncation_size
=
0
kwargs
:
dict
[
str
,
Any
]
=
{
"model"
:
MODEL_NAME
,
"input"
:
input
,
"truncate_prompt_tokens"
:
truncation_size
}
with
pytest
.
raises
(
openai
.
BadRequestError
)
as
err
:
await
client
.
post
(
path
=
"embeddings"
,
cast_to
=
object
,
body
=
{
**
kwargs
})
assert
err
.
value
.
status_code
==
400
error_details
=
err
.
value
.
response
.
json
()[
"error"
]
assert
error_details
[
"type"
]
==
"BadRequestError"
assert
"This model's maximum context length is"
in
error_details
[
"message"
]
assert
"tokens in the input for embedding generation"
in
error_details
[
"message"
]
assert
"Please reduce the length of the input"
in
error_details
[
"message"
]
@
pytest
.
mark
.
asyncio
@
pytest
.
mark
.
asyncio
async
def
test_bigger_truncation_size
(
client
:
openai
.
AsyncOpenAI
):
async
def
test_bigger_truncation_size
(
client
:
openai
.
AsyncOpenAI
):
truncation_size
=
max_model_len
+
1
truncation_size
=
max_model_len
+
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment