Unverified Commit b5a6b0db authored by Ayush Agarwal's avatar Ayush Agarwal Committed by GitHub
Browse files

fix: vllm default behaviour for generation prompt (#5223)


Signed-off-by: default avatarayushag <ayushag@nvidia.com>
parent 8e3c0d26
......@@ -233,17 +233,19 @@ impl OAIChatLikeRequest for NvCreateChatCompletionRequest {
}
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)
self.inner
.messages
.last()
.map(|last| {
!matches!(
last,
dynamo_async_openai::types::ChatCompletionRequestMessage::Assistant(_)
)
})
.unwrap_or(true)
// Using vLLM default behavior
true
// // Only add generation prompt if the last message was not assistant (default to true when no last message)
// self.inner
// .messages
// .last()
// .map(|last| {
// !matches!(
// last,
// dynamo_async_openai::types::ChatCompletionRequestMessage::Assistant(_)
// )
// })
// .unwrap_or(true)
}
fn extract_text(&self) -> Option<TextInput> {
......@@ -1181,9 +1183,6 @@ NORMAL MODE
fn user() -> Msg {
Msg::User(Default::default())
}
fn asst() -> Msg {
Msg::Assistant(Default::default())
}
fn tool() -> Msg {
Msg::Tool(Default::default())
}
......@@ -1208,12 +1207,6 @@ NORMAL MODE
assert!(s.should_add_generation_prompt());
}
#[test]
fn no_after_assistant() {
let s = dummy_state(vec![asst()]);
assert!(!s.should_add_generation_prompt());
}
#[test]
fn add_when_empty() {
let s = dummy_state(vec![]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment