pub enum Part {
Thought {
text: String,
thought: bool,
},
Text {
text: String,
},
InlineData {
inline_data: Blob,
},
FunctionCall {
function_call: FunctionCall,
},
FunctionResponse {
function_response: FunctionResponse,
},
ExecutableCode {
executable_code: ExecutableCode,
},
CodeExecutionResult {
code_execution_result: CodeExecutionResult,
},
}Expand description
A single part of a Content message.
Parts are polymorphic — discriminated by field presence, not a type tag.
Variants§
Thought
A thought/reasoning part from the model (when includeThoughts is enabled).
Text
A text part.
InlineData
An inline data blob (audio, image, etc.).
FunctionCall
A function call from the model.
Fields
§
function_call: FunctionCallThe function call details.
FunctionResponse
A function response sent back to the model.
Fields
§
function_response: FunctionResponseThe function response details.
ExecutableCode
Executable code returned by the model.
Fields
§
executable_code: ExecutableCodeThe executable code details.
CodeExecutionResult
Result of code execution.
Fields
§
code_execution_result: CodeExecutionResultThe code execution result details.
Implementations§
Source§impl Part
impl Part
Sourcepub fn text(s: impl Into<String>) -> Self
pub fn text(s: impl Into<String>) -> Self
Create a text part.
§Examples
use gemini_genai_rs::protocol::types::Part;
let part = Part::text("Hello, world!");Sourcepub fn inline_data(
mime_type: impl Into<String>,
data: impl Into<String>,
) -> Self
pub fn inline_data( mime_type: impl Into<String>, data: impl Into<String>, ) -> Self
Create an inline data part (e.g. audio or image blob).
§Examples
use gemini_genai_rs::protocol::types::Part;
let audio = Part::inline_data("audio/pcm", "AQIDBA==");
let image = Part::inline_data("image/jpeg", "/9j/4AAQ...");Sourcepub fn function_call(call: FunctionCall) -> Self
pub fn function_call(call: FunctionCall) -> Self
Create a function call part.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Part
impl<'de> Deserialize<'de> for Part
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Part
Auto Trait Implementations§
impl Freeze for Part
impl RefUnwindSafe for Part
impl Send for Part
impl Sync for Part
impl Unpin for Part
impl UnwindSafe for Part
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