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
db290610
Unverified
Commit
db290610
authored
Nov 25, 2025
by
Nick Hill
Committed by
GitHub
Nov 25, 2025
Browse files
[Misc] Streamline unique id generation (#29375)
Signed-off-by:
Nick Hill
<
nhill@redhat.com
>
parent
67fc16cd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
13 deletions
+16
-13
vllm/entrypoints/openai/protocol.py
vllm/entrypoints/openai/protocol.py
+8
-8
vllm/entrypoints/openai/serving_engine.py
vllm/entrypoints/openai/serving_engine.py
+5
-4
vllm/utils/__init__.py
vllm/utils/__init__.py
+3
-1
No files found.
vllm/entrypoints/openai/protocol.py
View file @
db290610
...
...
@@ -661,7 +661,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
),
)
request_id
:
str
=
Field
(
default_factory
=
lambda
:
f
"
{
random_uuid
()
}
"
,
default_factory
=
random_uuid
,
description
=
(
"The request_id related to this request. If the caller does "
"not set it, a random_uuid will be generated. This id is used "
...
...
@@ -1078,7 +1078,7 @@ class CompletionRequest(OpenAIBaseModel):
),
)
request_id
:
str
=
Field
(
default_factory
=
lambda
:
f
"
{
random_uuid
()
}
"
,
default_factory
=
random_uuid
,
description
=
(
"The request_id related to this request. If the caller does "
"not set it, a random_uuid will be generated. This id is used "
...
...
@@ -1375,7 +1375,7 @@ class EmbeddingCompletionRequest(OpenAIBaseModel):
),
)
request_id
:
str
=
Field
(
default_factory
=
lambda
:
f
"
{
random_uuid
()
}
"
,
default_factory
=
random_uuid
,
description
=
(
"The request_id related to this request. If the caller does "
"not set it, a random_uuid will be generated. This id is used "
...
...
@@ -1470,7 +1470,7 @@ class EmbeddingChatRequest(OpenAIBaseModel):
),
)
request_id
:
str
=
Field
(
default_factory
=
lambda
:
f
"
{
random_uuid
()
}
"
,
default_factory
=
random_uuid
,
description
=
(
"The request_id related to this request. If the caller does "
"not set it, a random_uuid will be generated. This id is used "
...
...
@@ -1892,7 +1892,7 @@ class ClassificationCompletionRequest(OpenAIBaseModel):
),
)
request_id
:
str
=
Field
(
default_factory
=
lambda
:
f
"
{
random_uuid
()
}
"
,
default_factory
=
random_uuid
,
description
=
(
"The request_id related to this request. If the caller does "
"not set it, a random_uuid will be generated. This id is used "
...
...
@@ -1983,7 +1983,7 @@ class ClassificationChatRequest(OpenAIBaseModel):
)
request_id
:
str
=
Field
(
default_factory
=
lambda
:
f
"
{
random_uuid
()
}
"
,
default_factory
=
random_uuid
,
description
=
(
"The request_id related to this request. If the caller does "
"not set it, a random_uuid will be generated. This id is used "
...
...
@@ -3094,7 +3094,7 @@ class TranslationResponseVerbose(OpenAIBaseModel):
####### Tokens IN <> Tokens OUT #######
class
GenerateRequest
(
BaseModel
):
request_id
:
str
=
Field
(
default_factory
=
lambda
:
f
"
{
random_uuid
()
}
"
,
default_factory
=
random_uuid
,
description
=
(
"The request_id related to this request. If the caller does "
"not set it, a random_uuid will be generated. This id is used "
...
...
@@ -3151,7 +3151,7 @@ class GenerateResponseChoice(BaseModel):
class
GenerateResponse
(
BaseModel
):
request_id
:
str
=
Field
(
default_factory
=
lambda
:
f
"
{
random_uuid
()
}
"
,
default_factory
=
random_uuid
,
description
=
(
"The request_id related to this request. If the caller does "
"not set it, a random_uuid will be generated. This id is used "
...
...
vllm/entrypoints/openai/serving_engine.py
View file @
db290610
...
...
@@ -1349,11 +1349,12 @@ class OpenAIServing:
raw_request
:
Request
|
None
,
default
:
str
|
None
=
None
)
->
str
|
None
:
"""Pulls the request id to use from a header, if provided"""
default
=
default
or
random_uuid
()
if
raw_request
is
None
:
return
default
if
raw_request
is
not
None
and
(
(
req_id
:
=
raw_request
.
headers
.
get
(
"X-Request-Id"
))
is
not
None
):
return
req_id
return
ra
w_request
.
headers
.
get
(
"X-Request-Id"
,
default
)
return
ra
ndom_uuid
()
if
default
is
None
else
default
@
staticmethod
def
_get_data_parallel_rank
(
raw_request
:
Request
|
None
)
->
int
|
None
:
...
...
vllm/utils/__init__.py
View file @
db290610
...
...
@@ -52,9 +52,11 @@ STR_FLASHINFER_ATTN_VAL: str = "FLASHINFER"
STR_FLASH_ATTN_VAL
:
str
=
"FLASH_ATTN"
STR_INVALID_VAL
:
str
=
"INVALID"
MASK_64_BITS
=
(
1
<<
64
)
-
1
def
random_uuid
()
->
str
:
return
str
(
uuid
.
uuid4
().
hex
)
return
f
"
{
uuid
.
uuid4
().
int
&
MASK_64_BITS
:
016
x
}
"
# 16 hex chars
def
length_from_prompt_token_ids_or_embeds
(
...
...
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