pub struct DeepSeekConfig {
pub api_key: String,
pub model: String,
pub base_url: Option<String>,
pub thinking: Option<ThinkingMode>,
pub reasoning_effort: Option<ReasoningEffort>,
pub max_tokens: Option<u32>,
pub beta: bool,
pub strict_tools: bool,
pub thinking_enabled: bool,
}models and deepseek only.Expand description
Configuration for DeepSeek API.
§V4 Models
use adk_model::deepseek::DeepSeekConfig;
// V4 Pro (strongest reasoning)
let pro = DeepSeekConfig::v4_pro("api-key");
// V4 Flash (fast, cost-efficient)
let flash = DeepSeekConfig::v4_flash("api-key");
// V4 Pro with max reasoning effort
let pro_max = DeepSeekConfig::v4_pro("api-key")
.with_reasoning_effort(ReasoningEffort::Max);Fields§
§api_key: StringDeepSeek API key.
model: StringModel name (e.g., "deepseek-v4-pro", "deepseek-v4-flash", "deepseek-chat").
base_url: Option<String>Optional custom base URL.
thinking: Option<ThinkingMode>Thinking mode toggle. None = server default (enabled for V4).
reasoning_effort: Option<ReasoningEffort>Reasoning effort level. None = server default (high).
max_tokens: Option<u32>Maximum tokens for output.
beta: boolEnable beta features (prefix completion, FIM, strict tool mode).
When true, uses https://api.deepseek.com/beta as base URL.
strict_tools: boolEnable strict tool mode (beta). When true, tool definitions include
"strict": true and the model strictly follows the JSON schema.
thinking_enabled: boolLegacy field: true maps to thinking: Some(Enabled).
Prefer using thinking directly for new code.
Implementations§
Source§impl DeepSeekConfig
impl DeepSeekConfig
Sourcepub fn new(
api_key: impl Into<String>,
model: impl Into<String>,
) -> DeepSeekConfig
pub fn new( api_key: impl Into<String>, model: impl Into<String>, ) -> DeepSeekConfig
Create a new DeepSeek config with the given API key and model.
Sourcepub fn v4_pro(api_key: impl Into<String>) -> DeepSeekConfig
pub fn v4_pro(api_key: impl Into<String>) -> DeepSeekConfig
Create a config for deepseek-v4-pro (strongest reasoning, thinking enabled).
Sourcepub fn v4_flash(api_key: impl Into<String>) -> DeepSeekConfig
pub fn v4_flash(api_key: impl Into<String>) -> DeepSeekConfig
Create a config for deepseek-v4-flash (fast, cost-efficient).
Sourcepub fn chat(api_key: impl Into<String>) -> DeepSeekConfig
pub fn chat(api_key: impl Into<String>) -> DeepSeekConfig
Create a config for deepseek-chat model.
Sourcepub fn reasoner(api_key: impl Into<String>) -> DeepSeekConfig
pub fn reasoner(api_key: impl Into<String>) -> DeepSeekConfig
Create a config for deepseek-reasoner model with thinking enabled.
Sourcepub fn with_thinking_mode(self, mode: ThinkingMode) -> DeepSeekConfig
pub fn with_thinking_mode(self, mode: ThinkingMode) -> DeepSeekConfig
Set thinking mode explicitly.
When set to Disabled, reasoning_effort is cleared since the API
rejects the combination of disabled thinking with a reasoning effort.
Sourcepub fn with_thinking(self, enabled: bool) -> DeepSeekConfig
pub fn with_thinking(self, enabled: bool) -> DeepSeekConfig
Enable or disable thinking mode (legacy API, prefer with_thinking_mode).
Sourcepub fn with_reasoning_effort(self, effort: ReasoningEffort) -> DeepSeekConfig
pub fn with_reasoning_effort(self, effort: ReasoningEffort) -> DeepSeekConfig
Set reasoning effort level for thinking mode.
Sourcepub fn with_max_tokens(self, max_tokens: u32) -> DeepSeekConfig
pub fn with_max_tokens(self, max_tokens: u32) -> DeepSeekConfig
Set max tokens for output.
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> DeepSeekConfig
pub fn with_base_url(self, base_url: impl Into<String>) -> DeepSeekConfig
Set custom base URL.
Sourcepub fn with_beta(self) -> DeepSeekConfig
pub fn with_beta(self) -> DeepSeekConfig
Enable beta features (prefix completion, FIM, strict tool mode).
Sourcepub fn with_strict_tools(self) -> DeepSeekConfig
pub fn with_strict_tools(self) -> DeepSeekConfig
Enable strict tool mode (beta feature).
Tool definitions will include "strict": true and the model will
strictly follow the JSON schema for tool call arguments.
Sourcepub fn effective_base_url(&self) -> &str
pub fn effective_base_url(&self) -> &str
Get the effective base URL.
Sourcepub fn is_thinking_enabled(&self) -> bool
pub fn is_thinking_enabled(&self) -> bool
Whether thinking mode is effectively enabled.
Trait Implementations§
Source§impl Clone for DeepSeekConfig
impl Clone for DeepSeekConfig
Source§fn clone(&self) -> DeepSeekConfig
fn clone(&self) -> DeepSeekConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DeepSeekConfig
impl Debug for DeepSeekConfig
Source§impl Default for DeepSeekConfig
impl Default for DeepSeekConfig
Source§fn default() -> DeepSeekConfig
fn default() -> DeepSeekConfig
Source§impl<'de> Deserialize<'de> for DeepSeekConfig
impl<'de> Deserialize<'de> for DeepSeekConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DeepSeekConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DeepSeekConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for DeepSeekConfig
impl Serialize for DeepSeekConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for DeepSeekConfig
impl RefUnwindSafe for DeepSeekConfig
impl Send for DeepSeekConfig
impl Sync for DeepSeekConfig
impl Unpin for DeepSeekConfig
impl UnsafeUnpin for DeepSeekConfig
impl UnwindSafe for DeepSeekConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request