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
dynamo
Commits
b5a6b0db
Unverified
Commit
b5a6b0db
authored
Jan 07, 2026
by
Ayush Agarwal
Committed by
GitHub
Jan 07, 2026
Browse files
fix: vllm default behaviour for generation prompt (#5223)
Signed-off-by:
ayushag
<
ayushag@nvidia.com
>
parent
8e3c0d26
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
20 deletions
+13
-20
lib/llm/src/preprocessor/prompt/template/oai.rs
lib/llm/src/preprocessor/prompt/template/oai.rs
+13
-20
No files found.
lib/llm/src/preprocessor/prompt/template/oai.rs
View file @
b5a6b0db
...
@@ -233,17 +233,19 @@ impl OAIChatLikeRequest for NvCreateChatCompletionRequest {
...
@@ -233,17 +233,19 @@ impl OAIChatLikeRequest for NvCreateChatCompletionRequest {
}
}
fn
should_add_generation_prompt
(
&
self
)
->
bool
{
fn
should_add_generation_prompt
(
&
self
)
->
bool
{
// Only add generation prompt if the last message was not assistant (default to true when no last message)
// Using vLLM default behavior
self
.inner
true
.messages
// // Only add generation prompt if the last message was not assistant (default to true when no last message)
.last
()
// self.inner
.map
(|
last
|
{
// .messages
!
matches!
(
// .last()
last
,
// .map(|last| {
dynamo_async_openai
::
types
::
ChatCompletionRequestMessage
::
Assistant
(
_
)
// !matches!(
)
// last,
})
// dynamo_async_openai::types::ChatCompletionRequestMessage::Assistant(_)
.unwrap_or
(
true
)
// )
// })
// .unwrap_or(true)
}
}
fn
extract_text
(
&
self
)
->
Option
<
TextInput
>
{
fn
extract_text
(
&
self
)
->
Option
<
TextInput
>
{
...
@@ -1181,9 +1183,6 @@ NORMAL MODE
...
@@ -1181,9 +1183,6 @@ NORMAL MODE
fn
user
()
->
Msg
{
fn
user
()
->
Msg
{
Msg
::
User
(
Default
::
default
())
Msg
::
User
(
Default
::
default
())
}
}
fn
asst
()
->
Msg
{
Msg
::
Assistant
(
Default
::
default
())
}
fn
tool
()
->
Msg
{
fn
tool
()
->
Msg
{
Msg
::
Tool
(
Default
::
default
())
Msg
::
Tool
(
Default
::
default
())
}
}
...
@@ -1208,12 +1207,6 @@ NORMAL MODE
...
@@ -1208,12 +1207,6 @@ NORMAL MODE
assert
!
(
s
.should_add_generation_prompt
());
assert
!
(
s
.should_add_generation_prompt
());
}
}
#[test]
fn
no_after_assistant
()
{
let
s
=
dummy_state
(
vec!
[
asst
()]);
assert
!
(
!
s
.should_add_generation_prompt
());
}
#[test]
#[test]
fn
add_when_empty
()
{
fn
add_when_empty
()
{
let
s
=
dummy_state
(
vec!
[]);
let
s
=
dummy_state
(
vec!
[]);
...
...
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