pub struct FunctionInvokingChatClient<C>where
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> FunctionInvokingChatClient<C>where
C: ChatClient,
impl<C> FunctionInvokingChatClient<C>where
C: ChatClient,
pub fn new(inner: C) -> FunctionInvokingChatClient<C>
Sourcepub fn with_observability_config(
self,
observability: ObservabilityConfig,
) -> FunctionInvokingChatClient<C>
pub fn with_observability_config( self, observability: ObservabilityConfig, ) -> FunctionInvokingChatClient<C>
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,
) -> FunctionInvokingChatClient<C>
pub fn with_config( self, config: FunctionInvocationConfig, ) -> FunctionInvokingChatClient<C>
Override the function-invocation configuration.
Sourcepub fn with_function_middleware(
self,
middleware: Vec<Arc<dyn Middleware<FunctionInvocationContext>>>,
) -> FunctionInvokingChatClient<C>
pub fn with_function_middleware( self, middleware: Vec<Arc<dyn Middleware<FunctionInvocationContext>>>, ) -> FunctionInvokingChatClient<C>
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.