pub struct FilteredToolset { /* private fields */ }Expand description
A toolset wrapper that filters tools from an inner toolset using a predicate.
Works with any Toolset implementation. Tools that do not satisfy the
predicate are excluded from the resolved tool list.
§Example
ⓘ
use adk_tool::toolset::{FilteredToolset, string_predicate};
let browser = BrowserToolset::new(session);
let filtered = FilteredToolset::new(
Arc::new(browser),
string_predicate(vec!["navigate".into(), "click".into()]),
);
// Only "navigate" and "click" tools will be exposedImplementations§
Source§impl FilteredToolset
impl FilteredToolset
Sourcepub fn new(inner: Arc<dyn Toolset>, predicate: ToolPredicate) -> Self
pub fn new(inner: Arc<dyn Toolset>, predicate: ToolPredicate) -> Self
Wrap inner and keep only tools that satisfy predicate.
Trait Implementations§
Source§impl Toolset for FilteredToolset
impl Toolset for FilteredToolset
Source§fn tools<'life0, 'async_trait>(
&'life0 self,
ctx: Arc<dyn ReadonlyContext>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Arc<dyn Tool>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn tools<'life0, 'async_trait>(
&'life0 self,
ctx: Arc<dyn ReadonlyContext>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Arc<dyn Tool>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the tools available in this toolset for the given context.
Source§fn process_llm_request<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: Arc<dyn ReadonlyContext>,
_request: &'life1 mut LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn process_llm_request<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: Arc<dyn ReadonlyContext>,
_request: &'life1 mut LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Applies toolset-specific context to an LLM request before each model call. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for FilteredToolset
impl !UnwindSafe for FilteredToolset
impl Freeze for FilteredToolset
impl Send for FilteredToolset
impl Sync for FilteredToolset
impl Unpin for FilteredToolset
impl UnsafeUnpin for FilteredToolset
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