pub enum Part {
Thinking {
thinking: String,
signature: Option<String>,
},
Text {
text: String,
},
InlineData {
mime_type: String,
data: Vec<u8>,
},
FileData {
mime_type: String,
file_uri: String,
},
FunctionCall {
name: String,
args: Value,
id: Option<String>,
thought_signature: Option<String>,
},
FunctionResponse {
function_response: FunctionResponseData,
id: Option<String>,
},
ServerToolCall {
server_tool_call: Value,
},
ServerToolResponse {
server_tool_response: Value,
},
}Expand description
Core traits and types.
Always available regardless of feature flags. Includes:
Variants§
Thinking
Thinking/reasoning trace from a thinking-capable model.
Must be placed before Text in the enum so that #[serde(untagged)]
deserialization matches {"thinking": "..."} before falling through to Text.
Text
InlineData
FileData
File data referenced by URI (URL or cloud storage path).
This allows referencing external files without embedding the data inline. Providers that don’t support URI-based content can fetch and convert to InlineData.
§Example
use adk_core::Part;
let image_url = Part::FileData {
mime_type: "image/jpeg".to_string(),
file_uri: "https://example.com/image.jpg".to_string(),
};Fields
FunctionCall
Fields
FunctionResponse
Fields
function_response: FunctionResponseDataServerToolCall
Server-side tool call data from Gemini 3 built-in tool invocations. Stored as opaque JSON to avoid coupling core types to provider-specific schemas.
ServerToolResponse
Server-side tool response data from Gemini 3 built-in tool invocations. Stored as opaque JSON to avoid coupling core types to provider-specific schemas.
Implementations§
Source§impl Part
impl Part
Sourcepub fn text(&self) -> Option<&str>
pub fn text(&self) -> Option<&str>
Returns the text content if this is a Text part, None otherwise
Sourcepub fn is_thinking(&self) -> bool
pub fn is_thinking(&self) -> bool
Returns true if this part is a Thinking variant
Sourcepub fn thinking_text(&self) -> Option<&str>
pub fn thinking_text(&self) -> Option<&str>
Returns the thinking text content if this is a Thinking part, None otherwise
Sourcepub fn mime_type(&self) -> Option<&str>
pub fn mime_type(&self) -> Option<&str>
Returns the MIME type if this part has one (InlineData or FileData)
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>,
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,
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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request