pub struct FunctionResponseData {
pub name: String,
pub response: Value,
pub inline_data: Vec<InlineDataPart>,
pub file_data: Vec<FileDataPart>,
}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 · 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§impl Serialize for FunctionResponseData
impl Serialize for FunctionResponseData
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 FunctionResponseData
Auto Trait Implementations§
impl Freeze for FunctionResponseData
impl RefUnwindSafe for FunctionResponseData
impl Send for FunctionResponseData
impl Sync for FunctionResponseData
impl Unpin for FunctionResponseData
impl UnsafeUnpin for FunctionResponseData
impl UnwindSafe for FunctionResponseData
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