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:
Agent- The fundamental trait for all agentsTool/Toolset- For extending agents with capabilitiesSession/State- For managing conversation contextEvent- For streaming agent responsesAdkError/Result- Unified error handling A single part of aContentmessage.
Parts can be text, binary data, file references, function calls/responses, thinking traces, or server-side tool interactions.
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.
Fields
Text
Plain text content.
InlineData
Inline binary data (images, audio, etc.).
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
A function (tool) call from the model.
Fields
FunctionResponse
A function (tool) response.
Fields
function_response: FunctionResponseDataThe function response data.
ServerToolCall
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)