pub struct FunctionInvokingChatClient<C: ChatClient> { /* private fields */ }Expand description
Wraps a ChatClient to automatically execute local tool calls in a loop,
mirroring use_function_invocation.
Implementations§
Source§impl<C: ChatClient> FunctionInvokingChatClient<C>
impl<C: ChatClient> FunctionInvokingChatClient<C>
pub fn new(inner: C) -> Self
Sourcepub fn with_observability_config(
self,
observability: ObservabilityConfig,
) -> Self
pub fn with_observability_config( self, observability: ObservabilityConfig, ) -> Self
Set the ObservabilityConfig
governing this client’s execute_tool spans. Pass the same config given
to an ObservableChatClient
wrapping the same stack, so one trace reports one semantic-convention
version throughout.
Sourcepub fn with_config(self, config: FunctionInvocationConfig) -> Self
pub fn with_config(self, config: FunctionInvocationConfig) -> Self
Override the function-invocation configuration.
Sourcepub fn with_function_middleware(
self,
middleware: Vec<Arc<FunctionMiddleware>>,
) -> Self
pub fn with_function_middleware( self, middleware: Vec<Arc<FunctionMiddleware>>, ) -> Self
Configure the function-invocation middleware pipeline run around every
tool call: middleware may inspect/rewrite
FunctionInvocationContext::arguments, short-circuit execution by
setting FunctionInvocationContext::result (and either not calling
next, or setting terminate = true), or observe a propagated
execution error by matching on the Result returned from their own
next.run(...) call. Replaces any previously configured middleware.