pub struct VectorCollectionContextProvider { /* private fields */ }Expand description
Exposes a vector collection to an agent as tools. See the module docs.
Implementations§
Source§impl VectorCollectionContextProvider
impl VectorCollectionContextProvider
Sourcepub const DEFAULT_SOURCE_ID: &'static str = "vector_collection"
pub const DEFAULT_SOURCE_ID: &'static str = "vector_collection"
The default source_id.
Sourcepub fn builder(
collection: Arc<dyn VectorCollection>,
embedder: Arc<dyn EmbeddingClient>,
) -> VectorCollectionContextProviderBuilder
pub fn builder( collection: Arc<dyn VectorCollection>, embedder: Arc<dyn EmbeddingClient>, ) -> VectorCollectionContextProviderBuilder
Start building a provider over collection.
embedder turns a model’s query text — and, with
embed_from_field,
a record’s text — into a vector. It is required because this port’s
VectorCollection::search takes a vector, where upstream’s
collection owns an embedding generator and embeds internally.
Sourcepub fn tools(&self) -> &[ToolDefinition]
pub fn tools(&self) -> &[ToolDefinition]
The tools this provider contributes to a run.
Sourcepub fn instructions(&self) -> &[String]
pub fn instructions(&self) -> &[String]
The instructions this provider contributes to a run.
Trait Implementations§
Source§impl ContextProvider for VectorCollectionContextProvider
impl ContextProvider for VectorCollectionContextProvider
Source§fn before_run<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut SessionContext,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VectorCollectionContextProvider: 'async_trait,
fn before_run<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut SessionContext,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
VectorCollectionContextProvider: 'async_trait,
Called before the model is invoked; mutate ctx to inject instructions,
messages, and/or tools. Read ctx.input_messages / ctx.session_id.
Source§fn after_run<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_request_messages: &'life1 [Message],
_response_messages: &'life2 [Message],
_error: Option<&'life3 Error>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn after_run<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_request_messages: &'life1 [Message],
_response_messages: &'life2 [Message],
_error: Option<&'life3 Error>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Called after an invocation completes, on BOTH success and failure.
On success, error is None and response_messages holds the output.
On failure, error is Some and response_messages is empty.
Source§fn is_history_provider(&self) -> bool
fn is_history_provider(&self) -> bool
Whether this provider manages conversation history (a
HistoryProvider). Agent
and WorkflowAgent use this to
detect an already-attached history provider among a session’s
context_providers and avoid auto-attaching a redundant
InMemoryHistoryProvider.
Defaults to false; history providers override it to true.Auto Trait Implementations§
impl !RefUnwindSafe for VectorCollectionContextProvider
impl !UnwindSafe for VectorCollectionContextProvider
impl Freeze for VectorCollectionContextProvider
impl Send for VectorCollectionContextProvider
impl Sync for VectorCollectionContextProvider
impl Unpin for VectorCollectionContextProvider
impl UnsafeUnpin for VectorCollectionContextProvider
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