fix: remove extra_body param from GLM client - NVIDIA API rejects it
All checks were successful
BotServer CI/CD / build (push) Successful in 5m58s
All checks were successful
BotServer CI/CD / build (push) Successful in 5m58s
This commit is contained in:
parent
81c60ceb25
commit
5a24137a5b
1 changed files with 20 additions and 46 deletions
|
|
@ -36,20 +36,6 @@ pub struct GLMRequest {
|
||||||
pub tools: Option<Vec<Value>>,
|
pub tools: Option<Vec<Value>>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub tool_choice: Option<Value>,
|
pub tool_choice: Option<Value>,
|
||||||
#[serde(rename = "extra_body", skip_serializing_if = "Option::is_none")]
|
|
||||||
pub extra_body: Option<GLMExtraBody>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
||||||
pub struct GLMExtraBody {
|
|
||||||
#[serde(rename = "chat_template_kwargs")]
|
|
||||||
pub chat_template_kwargs: GLMChatTemplateKwargs,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
||||||
pub struct GLMChatTemplateKwargs {
|
|
||||||
pub enable_thinking: bool,
|
|
||||||
pub clear_thinking: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
|
@ -163,22 +149,16 @@ impl LLMProvider for GLMClient {
|
||||||
model
|
model
|
||||||
};
|
};
|
||||||
|
|
||||||
let request = GLMRequest {
|
let request = GLMRequest {
|
||||||
model: model_name.to_string(),
|
model: model_name.to_string(),
|
||||||
messages,
|
messages,
|
||||||
stream: Some(false),
|
stream: Some(false),
|
||||||
max_tokens: None,
|
max_tokens: None,
|
||||||
temperature: Some(1.0),
|
temperature: Some(1.0),
|
||||||
top_p: Some(1.0),
|
top_p: Some(1.0),
|
||||||
tools: None,
|
tools: None,
|
||||||
tool_choice: None,
|
tool_choice: None,
|
||||||
extra_body: Some(GLMExtraBody {
|
};
|
||||||
chat_template_kwargs: GLMChatTemplateKwargs {
|
|
||||||
enable_thinking: true,
|
|
||||||
clear_thinking: false,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
let url = self.build_url();
|
let url = self.build_url();
|
||||||
info!("GLM non-streaming request to: {}", url);
|
info!("GLM non-streaming request to: {}", url);
|
||||||
|
|
@ -262,22 +242,16 @@ impl LLMProvider for GLMClient {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let request = GLMRequest {
|
let request = GLMRequest {
|
||||||
model: model_name.to_string(),
|
model: model_name.to_string(),
|
||||||
messages,
|
messages,
|
||||||
stream: Some(true),
|
stream: Some(true),
|
||||||
max_tokens: None,
|
max_tokens: None,
|
||||||
temperature: Some(1.0),
|
temperature: Some(1.0),
|
||||||
top_p: Some(1.0),
|
top_p: Some(1.0),
|
||||||
tools: tools.cloned(),
|
tools: tools.cloned(),
|
||||||
tool_choice,
|
tool_choice,
|
||||||
extra_body: Some(GLMExtraBody {
|
};
|
||||||
chat_template_kwargs: GLMChatTemplateKwargs {
|
|
||||||
enable_thinking: true,
|
|
||||||
clear_thinking: false,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
let url = self.build_url();
|
let url = self.build_url();
|
||||||
info!("GLM streaming request to: {}", url);
|
info!("GLM streaming request to: {}", url);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue