pub struct ThinkingPart {
pub content: String,
pub id: Option<String>,
pub signature: Option<String>,
pub provider_name: Option<String>,
pub provider_details: Option<Map<String, Value>>,
}Expand description
Thinking/reasoning content part.
Used for models that support “thinking” or chain-of-thought reasoning, like Claude’s extended thinking feature.
Fields§
§content: StringThe thinking content.
id: Option<String>Optional unique identifier for this part.
signature: Option<String>Optional signature for verification.
provider_name: Option<String>Provider name that generated this thinking content.
provider_details: Option<Map<String, Value>>Provider-specific details/metadata.
Implementations§
Source§impl ThinkingPart
impl ThinkingPart
Sourcepub const REDACTED_THINKING_ID: &'static str = "redacted_thinking"
pub const REDACTED_THINKING_ID: &'static str = "redacted_thinking"
ID used for Anthropic redacted thinking blocks.
Sourcepub const REDACTED_CONTENT_ID: &'static str = "redacted_content"
pub const REDACTED_CONTENT_ID: &'static str = "redacted_content"
ID used for Bedrock redacted content blocks.
Sourcepub fn new(content: impl Into<String>) -> ThinkingPart
pub fn new(content: impl Into<String>) -> ThinkingPart
Create a new thinking part.
Sourcepub fn redacted(
signature: impl Into<String>,
provider_name: impl Into<String>,
) -> ThinkingPart
pub fn redacted( signature: impl Into<String>, provider_name: impl Into<String>, ) -> ThinkingPart
Create a redacted thinking part.
Redacted thinking blocks contain encrypted/hidden content. The signature must be preserved and sent back to the API in subsequent requests.
§Arguments
signature- The encrypted/encoded data from the providerprovider_name- The provider that generated this (e.g., “anthropic”, “bedrock”)
Sourcepub fn redacted_with_id(
id: impl Into<String>,
signature: impl Into<String>,
provider_name: impl Into<String>,
) -> ThinkingPart
pub fn redacted_with_id( id: impl Into<String>, signature: impl Into<String>, provider_name: impl Into<String>, ) -> ThinkingPart
Create a redacted thinking part with a specific ID.
Sourcepub fn with_id(self, id: impl Into<String>) -> ThinkingPart
pub fn with_id(self, id: impl Into<String>) -> ThinkingPart
Set the part ID.
Sourcepub fn with_signature(self, signature: impl Into<String>) -> ThinkingPart
pub fn with_signature(self, signature: impl Into<String>) -> ThinkingPart
Set the signature.
Sourcepub fn with_provider_name(self, name: impl Into<String>) -> ThinkingPart
pub fn with_provider_name(self, name: impl Into<String>) -> ThinkingPart
Set the provider name.
Sourcepub fn with_provider_details(self, details: Map<String, Value>) -> ThinkingPart
pub fn with_provider_details(self, details: Map<String, Value>) -> ThinkingPart
Set provider-specific details.
Sourcepub fn is_redacted(&self) -> bool
pub fn is_redacted(&self) -> bool
Check if this is a redacted thinking block.
Redacted blocks have their content hidden/encrypted by the provider.
The signature field contains the encrypted data that must be
round-tripped back to the API.
Sourcepub fn redacted_signature(&self) -> Option<&str>
pub fn redacted_signature(&self) -> Option<&str>
Get the signature if this is a redacted block.
Trait Implementations§
Source§impl Clone for ThinkingPart
impl Clone for ThinkingPart
Source§fn clone(&self) -> ThinkingPart
fn clone(&self) -> ThinkingPart
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more