pub struct FunctionResponseData {
pub name: String,
pub response: Value,
pub inline_data: Vec<InlineDataPart>,
pub file_data: Vec<FileDataPart>,
}Expand description
Core traits and types.
Always available regardless of feature flags. Includes:
Fields§
§name: String§response: Value§inline_data: Vec<InlineDataPart>Optional inline binary data parts (images, audio, PDFs).
Each part is validated against MAX_INLINE_DATA_SIZE on construction.
file_data: Vec<FileDataPart>Optional file data references (URIs to external files).
Implementations§
Source§impl FunctionResponseData
impl FunctionResponseData
Sourcepub fn new(name: impl Into<String>, response: Value) -> FunctionResponseData
pub fn new(name: impl Into<String>, response: Value) -> FunctionResponseData
Create with JSON response only (backward-compatible).
§Example
use adk_core::FunctionResponseData;
let frd = FunctionResponseData::new("my_tool", serde_json::json!({"status": "ok"}));
assert!(frd.inline_data.is_empty());
assert!(frd.file_data.is_empty());Sourcepub fn with_inline_data(
name: impl Into<String>,
response: Value,
inline_data: Vec<InlineDataPart>,
) -> FunctionResponseData
pub fn with_inline_data( name: impl Into<String>, response: Value, inline_data: Vec<InlineDataPart>, ) -> FunctionResponseData
Create with JSON response and inline data parts.
§Panics
Panics if any inline data part exceeds MAX_INLINE_DATA_SIZE (10 MB).
Sourcepub fn with_file_data(
name: impl Into<String>,
response: Value,
file_data: Vec<FileDataPart>,
) -> FunctionResponseData
pub fn with_file_data( name: impl Into<String>, response: Value, file_data: Vec<FileDataPart>, ) -> FunctionResponseData
Create with JSON response and file data references.
Sourcepub fn with_multimodal(
name: impl Into<String>,
response: Value,
inline_data: Vec<InlineDataPart>,
file_data: Vec<FileDataPart>,
) -> FunctionResponseData
pub fn with_multimodal( name: impl Into<String>, response: Value, inline_data: Vec<InlineDataPart>, file_data: Vec<FileDataPart>, ) -> FunctionResponseData
Create with JSON response, inline data, and file data.
§Panics
Panics if any inline data part exceeds MAX_INLINE_DATA_SIZE (10 MB).
Sourcepub fn from_tool_result(
name: impl Into<String>,
value: Value,
) -> FunctionResponseData
pub fn from_tool_result( name: impl Into<String>, value: Value, ) -> FunctionResponseData
Construct from a tool’s return value, preserving multimodal parts if present.
If value is a JSON object containing inline_data or file_data arrays
(matching the FunctionResponseData schema), the multimodal parts are extracted
and the response field is used as the JSON payload. Otherwise, the entire
value is used as a plain JSON response (backward-compatible).
This allows tools to return multimodal data by including inline_data and/or
file_data in their JSON return value.
Trait Implementations§
Source§impl Clone for FunctionResponseData
impl Clone for FunctionResponseData
Source§fn clone(&self) -> FunctionResponseData
fn clone(&self) -> FunctionResponseData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FunctionResponseData
impl Debug for FunctionResponseData
Source§impl<'de> Deserialize<'de> for FunctionResponseData
impl<'de> Deserialize<'de> for FunctionResponseData
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<FunctionResponseData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<FunctionResponseData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for FunctionResponseData
impl PartialEq for FunctionResponseData
Source§fn eq(&self, other: &FunctionResponseData) -> bool
fn eq(&self, other: &FunctionResponseData) -> bool
self and other values to be equal, and is used by ==.