pub struct ThinkingType {
pub mode: ThinkingMode,
pub clear_thinking: Option<bool>,
}Expand description
Controls extended reasoning and whether reasoning context is cleared between turns.
§Examples
use zai_rs::model::{
chat::ChatCompletion,
chat_message_types::TextMessage,
chat_models::GLM5_2,
tools::ThinkingType,
};
let request = ChatCompletion::new(GLM5_2 {}, TextMessage::user("Solve this"))
.with_thinking(ThinkingType::enabled());
let request = ChatCompletion::new(GLM5_2 {}, TextMessage::user("Continue"))
.with_thinking(ThinkingType::enabled().with_clear_thinking(false));§Model compatibility
Thinking capabilities are available only on models that implement the
ThinkEnable trait, such as GLM-5.2, GLM-5.1, GLM-5, GLM-4.7, and GLM-4.5
series models.
Fields§
§mode: ThinkingModeWhether thinking is enabled or disabled.
clear_thinking: Option<bool>Whether to clear historical reasoning_content.
true(default for standard API): Clears reasoning content each turn.false(recommended for Coding / Agent): Preserves reasoning content across turns, enabling better context for multi-step tool calls.
Implementations§
Source§impl ThinkingType
impl ThinkingType
Sourcepub fn with_clear_thinking(self, clear: bool) -> Self
pub fn with_clear_thinking(self, clear: bool) -> Self
Set whether to clear historical reasoning content.
Use false for Coding / Agent scenarios where reasoning content should
be preserved across turns.
Trait Implementations§
Source§impl Clone for ThinkingType
impl Clone for ThinkingType
Source§fn clone(&self) -> ThinkingType
fn clone(&self) -> ThinkingType
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ThinkingType
Source§impl Debug for ThinkingType
impl Debug for ThinkingType
impl Eq for ThinkingType
Source§impl PartialEq for ThinkingType
impl PartialEq for ThinkingType
Source§impl Serialize for ThinkingType
impl Serialize for ThinkingType
impl StructuralPartialEq for ThinkingType
Auto Trait Implementations§
impl Freeze for ThinkingType
impl RefUnwindSafe for ThinkingType
impl Send for ThinkingType
impl Sync for ThinkingType
impl Unpin for ThinkingType
impl UnsafeUnpin for ThinkingType
impl UnwindSafe for ThinkingType
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.