mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-04-23 16:02:10 +00:00
Merge branch 'amihalik-update-chat-completion-messages' into ci-amihalik-update-chat-completion-messages
This commit is contained in:
commit
5cdee2a591
@ -800,18 +800,22 @@ mod tests {
|
|||||||
Message {
|
Message {
|
||||||
role: "user".to_string(),
|
role: "user".to_string(),
|
||||||
content: "Hi!".to_string(),
|
content: "Hi!".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
role: "assistant".to_string(),
|
role: "assistant".to_string(),
|
||||||
content: "Hello how can I help?".to_string(),
|
content: "Hello how can I help?".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
role: "user".to_string(),
|
role: "user".to_string(),
|
||||||
content: "What is Deep Learning?".to_string(),
|
content: "What is Deep Learning?".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
role: "assistant".to_string(),
|
role: "assistant".to_string(),
|
||||||
content: "magic!".to_string(),
|
content: "magic!".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
bos_token: Some("[BOS]"),
|
bos_token: Some("[BOS]"),
|
||||||
@ -861,22 +865,27 @@ mod tests {
|
|||||||
Message {
|
Message {
|
||||||
role: "user".to_string(),
|
role: "user".to_string(),
|
||||||
content: "Hi!".to_string(),
|
content: "Hi!".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
role: "user".to_string(),
|
role: "user".to_string(),
|
||||||
content: "Hi again!".to_string(),
|
content: "Hi again!".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
role: "assistant".to_string(),
|
role: "assistant".to_string(),
|
||||||
content: "Hello how can I help?".to_string(),
|
content: "Hello how can I help?".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
role: "user".to_string(),
|
role: "user".to_string(),
|
||||||
content: "What is Deep Learning?".to_string(),
|
content: "What is Deep Learning?".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
role: "assistant".to_string(),
|
role: "assistant".to_string(),
|
||||||
content: "magic!".to_string(),
|
content: "magic!".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
bos_token: Some("[BOS]"),
|
bos_token: Some("[BOS]"),
|
||||||
@ -931,18 +940,22 @@ mod tests {
|
|||||||
Message {
|
Message {
|
||||||
role: "user".to_string(),
|
role: "user".to_string(),
|
||||||
content: "Hi!".to_string(),
|
content: "Hi!".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
role: "assistant".to_string(),
|
role: "assistant".to_string(),
|
||||||
content: "Hello how can I help?".to_string(),
|
content: "Hello how can I help?".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
role: "user".to_string(),
|
role: "user".to_string(),
|
||||||
content: "What is Deep Learning?".to_string(),
|
content: "What is Deep Learning?".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
role: "assistant".to_string(),
|
role: "assistant".to_string(),
|
||||||
content: "magic!".to_string(),
|
content: "magic!".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
bos_token: Some("[BOS]"),
|
bos_token: Some("[BOS]"),
|
||||||
@ -981,18 +994,22 @@ mod tests {
|
|||||||
Message {
|
Message {
|
||||||
role: "user".to_string(),
|
role: "user".to_string(),
|
||||||
content: "Hi!".to_string(),
|
content: "Hi!".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
role: "assistant".to_string(),
|
role: "assistant".to_string(),
|
||||||
content: "Hello how can I help?".to_string(),
|
content: "Hello how can I help?".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
role: "user".to_string(),
|
role: "user".to_string(),
|
||||||
content: "What is Deep Learning?".to_string(),
|
content: "What is Deep Learning?".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
role: "assistant".to_string(),
|
role: "assistant".to_string(),
|
||||||
content: "magic!".to_string(),
|
content: "magic!".to_string(),
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
bos_token: Some("[BOS]"),
|
bos_token: Some("[BOS]"),
|
||||||
|
@ -378,6 +378,7 @@ impl ChatCompletion {
|
|||||||
message: Message {
|
message: Message {
|
||||||
role: "assistant".into(),
|
role: "assistant".into(),
|
||||||
content: output,
|
content: output,
|
||||||
|
name: None,
|
||||||
},
|
},
|
||||||
logprobs: return_logprobs
|
logprobs: return_logprobs
|
||||||
.then(|| ChatCompletionLogprobs::from((details.tokens, details.top_tokens))),
|
.then(|| ChatCompletionLogprobs::from((details.tokens, details.top_tokens))),
|
||||||
@ -453,6 +454,7 @@ fn default_request_messages() -> Vec<Message> {
|
|||||||
vec![Message {
|
vec![Message {
|
||||||
role: "user".to_string(),
|
role: "user".to_string(),
|
||||||
content: "My name is David and I".to_string(),
|
content: "My name is David and I".to_string(),
|
||||||
|
name: None,
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,6 +549,8 @@ pub(crate) struct Message {
|
|||||||
pub role: String,
|
pub role: String,
|
||||||
#[schema(example = "My name is David and I")]
|
#[schema(example = "My name is David and I")]
|
||||||
pub content: String,
|
pub content: String,
|
||||||
|
#[schema(example = "\"David\"")]
|
||||||
|
pub name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, ToSchema)]
|
#[derive(Clone, Debug, Deserialize, ToSchema)]
|
||||||
|
Loading…
Reference in New Issue
Block a user