mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-12 04:44:52 +00:00
Parameters are optional
This commit is contained in:
parent
507ecae147
commit
be00fb7fc0
@ -26,11 +26,12 @@ pub(crate) struct GenerateVertexInstance {
|
|||||||
pub(crate) struct VertexChat {
|
pub(crate) struct VertexChat {
|
||||||
messages: Vec<Message>,
|
messages: Vec<Message>,
|
||||||
// Messages is ignored there.
|
// Messages is ignored there.
|
||||||
|
#[serde(default)]
|
||||||
parameters: VertexParameters,
|
parameters: VertexParameters,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, ToSchema, Serialize)]
|
#[derive(Clone, Deserialize, ToSchema, Serialize, Default)]
|
||||||
#[cfg_attr(test, derive(Debug, PartialEq, Default))]
|
#[cfg_attr(test, derive(Debug, PartialEq))]
|
||||||
pub(crate) struct VertexParameters {
|
pub(crate) struct VertexParameters {
|
||||||
#[schema(example = "mistralai/Mistral-7B-Instruct-v0.2")]
|
#[schema(example = "mistralai/Mistral-7B-Instruct-v0.2")]
|
||||||
/// [UNUSED] ID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat API.
|
/// [UNUSED] ID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat API.
|
||||||
@ -316,6 +317,12 @@ mod tests {
|
|||||||
|
|
||||||
let _request: VertexChat = serde_json::from_value(string).expect("Can deserialize");
|
let _request: VertexChat = serde_json::from_value(string).expect("Can deserialize");
|
||||||
|
|
||||||
|
let string = serde_json::json!({
|
||||||
|
"messages": [{"role": "user", "content": "What's Deep Learning?"}],
|
||||||
|
});
|
||||||
|
|
||||||
|
let _request: VertexChat = serde_json::from_value(string).expect("Can deserialize");
|
||||||
|
|
||||||
let string = serde_json::json!({
|
let string = serde_json::json!({
|
||||||
|
|
||||||
"instances": [
|
"instances": [
|
||||||
|
Loading…
Reference in New Issue
Block a user