mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
deepseek: Add tool_choice field to DeepSeek request model (#56040)
Release Notes: - N/A reference: https://api-docs.deepseek.com/api/create-chat-completion/
This commit is contained in:
parent
57765207c8
commit
166c53206e
2 changed files with 15 additions and 0 deletions
|
|
@ -126,6 +126,8 @@ pub struct Request {
|
|||
pub reasoning_effort: Option<ReasoningEffort>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub response_format: Option<ResponseFormat>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub tool_choice: Option<ToolChoice>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub tools: Vec<ToolDefinition>,
|
||||
}
|
||||
|
|
@ -158,6 +160,14 @@ pub enum ResponseFormat {
|
|||
JsonObject,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Eq, PartialEq)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ToolChoice {
|
||||
None,
|
||||
Auto,
|
||||
Required,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
pub enum ToolDefinition {
|
||||
|
|
|
|||
|
|
@ -450,6 +450,11 @@ pub fn into_deepseek(
|
|||
None
|
||||
},
|
||||
response_format: None,
|
||||
tool_choice: request.tool_choice.map(|choice| match choice {
|
||||
LanguageModelToolChoice::Auto => deepseek::ToolChoice::Auto,
|
||||
LanguageModelToolChoice::Any => deepseek::ToolChoice::Required,
|
||||
LanguageModelToolChoice::None => deepseek::ToolChoice::None,
|
||||
}),
|
||||
tools: request
|
||||
.tools
|
||||
.into_iter()
|
||||
|
|
|
|||
Loading…
Reference in a new issue