pub struct FunctionResponse {
pub name: String,
pub response: Option<Value>,
pub parts: Vec<FunctionResponsePart>,
}Expand description
A response from a function
Fields§
§name: StringThe name of the function
response: Option<Value>The response from the function This must be a valid JSON object
parts: Vec<FunctionResponsePart>Multimodal parts nested inside the functionResponse wire object.
Contains inlineData and/or fileData entries that accompany the JSON response.
Gemini 3 expects these inside the functionResponse, not as sibling Content parts.
Implementations§
Source§impl FunctionResponse
impl FunctionResponse
Sourcepub fn new(name: impl Into<String>, response: Value) -> Self
pub fn new(name: impl Into<String>, response: Value) -> Self
Create a new function response with a JSON value
Sourcepub fn with_inline_data(
name: impl Into<String>,
response: Value,
inline_data: Vec<Blob>,
) -> Self
pub fn with_inline_data( name: impl Into<String>, response: Value, inline_data: Vec<Blob>, ) -> Self
Create with JSON response and inline data blobs.
Sourcepub fn with_file_data(
name: impl Into<String>,
response: Value,
file_data: Vec<FileDataRef>,
) -> Self
pub fn with_file_data( name: impl Into<String>, response: Value, file_data: Vec<FileDataRef>, ) -> Self
Create with JSON response and file data references.
Sourcepub fn inline_data_only(name: impl Into<String>, inline_data: Vec<Blob>) -> Self
pub fn inline_data_only(name: impl Into<String>, inline_data: Vec<Blob>) -> Self
Create with inline data only (no JSON response).
Sourcepub fn from_schema<Response>(
name: impl Into<String>,
response: Response,
) -> Result<Self, Error>where
Response: JsonSchema + Serialize,
pub fn from_schema<Response>(
name: impl Into<String>,
response: Response,
) -> Result<Self, Error>where
Response: JsonSchema + Serialize,
Create a new function response from a serializable type that will be parsed as JSON
Trait Implementations§
Source§impl Clone for FunctionResponse
impl Clone for FunctionResponse
Source§fn clone(&self) -> FunctionResponse
fn clone(&self) -> FunctionResponse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FunctionResponse
impl Debug for FunctionResponse
Source§impl<'de> Deserialize<'de> for FunctionResponse
impl<'de> Deserialize<'de> for FunctionResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for FunctionResponse
impl PartialEq for FunctionResponse
Source§fn eq(&self, other: &FunctionResponse) -> bool
fn eq(&self, other: &FunctionResponse) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for FunctionResponse
impl Serialize for FunctionResponse
impl StructuralPartialEq for FunctionResponse
Auto Trait Implementations§
impl Freeze for FunctionResponse
impl RefUnwindSafe for FunctionResponse
impl Send for FunctionResponse
impl Sync for FunctionResponse
impl Unpin for FunctionResponse
impl UnsafeUnpin for FunctionResponse
impl UnwindSafe for FunctionResponse
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