pub struct ToolContext {
pub storage: Arc<dyn StorageAdapter>,
pub conversation_id: String,
pub web_search: Arc<dyn WebSearchProvider>,
}Expand description
The context the built-in tool catalog is assembled from.
Cheap to clone — every field is Arc’d or a small owned value. Build one
with ToolContext::new and refine it with the with_* setters, then hand
it to builtin_tools.
Fields§
§storage: Arc<dyn StorageAdapter>The storage adapter — conversation_history reads the message log from
it.
conversation_id: StringThe conversation the tools operate within. conversation_history reads
this conversation’s recent messages.
web_search: Arc<dyn WebSearchProvider>The web-search provider. Defaults to NoopWebSearchProvider, which
returns an explanatory “no provider configured” result — so the
web_search tool is always present and never silently a no-op.
Implementations§
Source§impl ToolContext
impl ToolContext
Sourcepub fn new(
storage: Arc<dyn StorageAdapter>,
conversation_id: impl Into<String>,
) -> Self
pub fn new( storage: Arc<dyn StorageAdapter>, conversation_id: impl Into<String>, ) -> Self
Build a context over a storage adapter and conversation id, with the no-op web-search provider as the default.
Sourcepub fn with_web_search(self, provider: Arc<dyn WebSearchProvider>) -> Self
pub fn with_web_search(self, provider: Arc<dyn WebSearchProvider>) -> Self
Plug in a real web-search provider (e.g. a Brave/Bing/Tavily-backed
implementation). Replaces the default NoopWebSearchProvider.
Trait Implementations§
Source§impl Clone for ToolContext
impl Clone for ToolContext
Source§fn clone(&self) -> ToolContext
fn clone(&self) -> ToolContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ToolContext
impl !UnwindSafe for ToolContext
impl Freeze for ToolContext
impl Send for ToolContext
impl Sync for ToolContext
impl Unpin for ToolContext
impl UnsafeUnpin for ToolContext
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request