pub enum ModelResponsePart {
Text(TextPart),
ToolCall(ToolCallPart),
Thinking(ThinkingPart),
File(FilePart),
BuiltinToolCall(BuiltinToolCallPart),
}Expand description
Individual parts of a model response.
Variants§
Text(TextPart)
Text content.
ToolCall(ToolCallPart)
Tool call.
Thinking(ThinkingPart)
Thinking/reasoning content.
File(FilePart)
File content (e.g., generated images).
BuiltinToolCall(BuiltinToolCallPart)
Builtin tool call (web search, code execution, etc.).
Implementations§
Source§impl ModelResponsePart
impl ModelResponsePart
Sourcepub fn text(content: impl Into<String>) -> ModelResponsePart
pub fn text(content: impl Into<String>) -> ModelResponsePart
Create a text part.
Sourcepub fn tool_call(
tool_name: impl Into<String>,
args: impl Into<ToolCallArgs>,
) -> ModelResponsePart
pub fn tool_call( tool_name: impl Into<String>, args: impl Into<ToolCallArgs>, ) -> ModelResponsePart
Create a tool call part.
Sourcepub fn thinking(content: impl Into<String>) -> ModelResponsePart
pub fn thinking(content: impl Into<String>) -> ModelResponsePart
Create a thinking part.
Sourcepub fn file(data: Vec<u8>, media_type: impl Into<String>) -> ModelResponsePart
pub fn file(data: Vec<u8>, media_type: impl Into<String>) -> ModelResponsePart
Create a file part from raw bytes and media type.
Sourcepub fn builtin_tool_call(
tool_name: impl Into<String>,
args: impl Into<ToolCallArgs>,
) -> ModelResponsePart
pub fn builtin_tool_call( tool_name: impl Into<String>, args: impl Into<ToolCallArgs>, ) -> ModelResponsePart
Create a builtin tool call part.
Sourcepub fn is_tool_call(&self) -> bool
pub fn is_tool_call(&self) -> bool
Check if this is a tool call part.
Sourcepub fn is_thinking(&self) -> bool
pub fn is_thinking(&self) -> bool
Check if this is a thinking part.
Sourcepub fn is_builtin_tool_call(&self) -> bool
pub fn is_builtin_tool_call(&self) -> bool
Check if this is a builtin tool call part.
Trait Implementations§
Source§impl Clone for ModelResponsePart
impl Clone for ModelResponsePart
Source§fn clone(&self) -> ModelResponsePart
fn clone(&self) -> ModelResponsePart
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModelResponsePart
impl Debug for ModelResponsePart
Source§impl<'de> Deserialize<'de> for ModelResponsePart
impl<'de> Deserialize<'de> for ModelResponsePart
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModelResponsePart, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModelResponsePart, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<BuiltinToolCallPart> for ModelResponsePart
impl From<BuiltinToolCallPart> for ModelResponsePart
Source§fn from(p: BuiltinToolCallPart) -> ModelResponsePart
fn from(p: BuiltinToolCallPart) -> ModelResponsePart
Converts to this type from the input type.
Source§impl From<FilePart> for ModelResponsePart
impl From<FilePart> for ModelResponsePart
Source§fn from(p: FilePart) -> ModelResponsePart
fn from(p: FilePart) -> ModelResponsePart
Converts to this type from the input type.
Source§impl From<TextPart> for ModelResponsePart
impl From<TextPart> for ModelResponsePart
Source§fn from(p: TextPart) -> ModelResponsePart
fn from(p: TextPart) -> ModelResponsePart
Converts to this type from the input type.
Source§impl From<ThinkingPart> for ModelResponsePart
impl From<ThinkingPart> for ModelResponsePart
Source§fn from(p: ThinkingPart) -> ModelResponsePart
fn from(p: ThinkingPart) -> ModelResponsePart
Converts to this type from the input type.
Source§impl From<ToolCallPart> for ModelResponsePart
impl From<ToolCallPart> for ModelResponsePart
Source§fn from(p: ToolCallPart) -> ModelResponsePart
fn from(p: ToolCallPart) -> ModelResponsePart
Converts to this type from the input type.
Source§impl FromIterator<ModelResponsePart> for ModelResponse
impl FromIterator<ModelResponsePart> for ModelResponse
Source§fn from_iter<T>(iter: T) -> ModelResponsewhere
T: IntoIterator<Item = ModelResponsePart>,
fn from_iter<T>(iter: T) -> ModelResponsewhere
T: IntoIterator<Item = ModelResponsePart>,
Creates a value from an iterator. Read more
Source§impl PartialEq for ModelResponsePart
impl PartialEq for ModelResponsePart
Source§impl Serialize for ModelResponsePart
impl Serialize for ModelResponsePart
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,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ModelResponsePart
Auto Trait Implementations§
impl Freeze for ModelResponsePart
impl RefUnwindSafe for ModelResponsePart
impl Send for ModelResponsePart
impl Sync for ModelResponsePart
impl Unpin for ModelResponsePart
impl UnwindSafe for ModelResponsePart
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