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>) -> Part
pub fn text(s: impl Into<String>) -> Part
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>,
) -> Part
pub fn inline_data( mime_type: impl Into<String>, data: impl Into<String>, ) -> Part
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) -> Part
pub fn function_call(call: FunctionCall) -> Part
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<Part, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Part, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Part
impl Serialize for Part
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].