pub struct FunctionInvocation {
pub caller: FunctionCaller,
pub function_call_id: String,
pub surface_id: Option<String>,
pub name: String,
pub catalog_id: Option<String>,
pub args: Value,
}Expand description
A function call one side asks the other to run.
Fields§
§caller: FunctionCallerWho asks.
function_call_id: StringThe id the answer copies verbatim.
surface_id: Option<String>The surface whose data model the call reads; required when the renderer asks.
name: StringThe function’s registered name (@call).
catalog_id: Option<String>The catalog that defines it; required when the agent asks.
args: ValueIts arguments (args), {} when absent.
Implementations§
Source§impl FunctionInvocation
impl FunctionInvocation
Sourcepub fn refusal(&self, catalog: &Catalog) -> FunctionResponse
pub fn refusal(&self, catalog: &Catalog) -> FunctionResponse
The answer genui gives this call: INVALID_FUNCTION_CALL, with why. A forms
function is rendererOnly, so an agent may not call it; a renderer may call no agent
function, because none is offered.
§Example
use adk_surface::genui::{Catalog, FunctionMessage, INVALID_FUNCTION_CALL, read_function_message};
use serde_json::json;
let message = json!({ "version": "1.0", "callRendererFunction": {
"functionCallId": "c1",
"callFunction": { "@call": "formatString", "catalogId": Catalog::forms().id() } } });
let Some(FunctionMessage::Call(call)) = read_function_message(&message)? else { unreachable!() };
let answer = call.refusal(Catalog::forms()).to_wire();
assert_eq!(answer["rendererFunctionResponse"]["functionCallId"], "c1");
assert_eq!(answer["rendererFunctionResponse"]["error"]["code"], INVALID_FUNCTION_CALL);Trait Implementations§
Source§impl Clone for FunctionInvocation
impl Clone for FunctionInvocation
Source§impl Debug for FunctionInvocation
impl Debug for FunctionInvocation
Source§impl PartialEq for FunctionInvocation
impl PartialEq for FunctionInvocation
impl StructuralPartialEq for FunctionInvocation
Auto Trait Implementations§
impl Forget for FunctionInvocation
impl Freeze for FunctionInvocationwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
impl Move for FunctionInvocation
impl RefUnwindSafe for FunctionInvocation
impl Send for FunctionInvocation
impl Sync for FunctionInvocation
impl Unpin for FunctionInvocation
impl UnsafeUnpin for FunctionInvocationwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
impl UnwindSafe for FunctionInvocation
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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 more