Skip to main content

VectorCollectionContextProviderBuilder

Struct VectorCollectionContextProviderBuilder 

Source
pub struct VectorCollectionContextProviderBuilder { /* private fields */ }
Expand description

Implementations§

Source§

impl VectorCollectionContextProviderBuilder

Source

pub fn source_id( self, source_id: impl Into<String>, ) -> VectorCollectionContextProviderBuilder

Identify this provider in instruction and tool attribution. Defaults to "vector_collection".

Source

pub fn tool_prefix( self, prefix: impl Into<String>, ) -> VectorCollectionContextProviderBuilder

Prefix every generated tool’s name, e.g. "notes" gives notes_search.

The generated names are otherwise the plain search / get / upsert / delete upstream uses, which collide when an agent holds two of these providers — or one of these and any other tool called search. A collision is not a silent problem (the invocation loop resolves a call by name and would pick one of them), which is exactly why it is worth avoiding.

Source

pub fn scope_filter( self, filter: impl Into<FilterExpression>, ) -> VectorCollectionContextProviderBuilder

Scope every generated tool to the records matching filter. See the module docs for what this does and does not guarantee.

Source

pub fn instructions( self, instructions: Vec<String>, ) -> VectorCollectionContextProviderBuilder

Replace the generated instructions. An empty list adds none.

Source

pub fn embed_from_field( self, field_name: impl Into<String>, ) -> VectorCollectionContextProviderBuilder

Enable the upsert tool, embedding the named data field’s text into the collection’s vector field.

Without this there is no upsert tool, and build says so rather than offering one that cannot work: a model cannot author a 1,536-float embedding, and which of a collection’s fields carries the text it should be derived from is a property of the schema that nothing in the definition records. Upstream has no equivalent because its collection owns an embedding generator and does this itself.

Source

pub fn vector_field( self, name: impl Into<String>, ) -> VectorCollectionContextProviderBuilder

Name the vector field the generated tools use.

Only needed when the collection declares more than one, where there is no safe default: searching the wrong embedding returns confident nonsense rather than an error, so build refuses a multi-vector collection that does not name one.

Whether to generate the similarity-search tool. On by default.

Source

pub fn include_get( self, include: bool, ) -> VectorCollectionContextProviderBuilder

Whether to generate the read-by-key tool. On by default.

Source

pub fn include_delete( self, include: bool, ) -> VectorCollectionContextProviderBuilder

Whether to generate the delete-by-key tool. On by default.

Source

pub fn approval_mode( self, kind: VectorToolKind, mode: ApprovalMode, ) -> VectorCollectionContextProviderBuilder

Override one tool’s approval mode. See VectorToolKind::default_approval for the defaults.

Source

pub fn max_tool_batch_size( self, max: usize, ) -> VectorCollectionContextProviderBuilder

Cap how many records or keys one tool call may carry. See DEFAULT_MAX_TOOL_BATCH_SIZE.

Source

pub fn search_top(self, top: usize) -> VectorCollectionContextProviderBuilder

How many hits the search tool returns. See DEFAULT_SEARCH_TOP.

Source

pub fn search_embedding_options( self, options: EmbeddingGenerationOptions, ) -> VectorCollectionContextProviderBuilder

Provider options for the embedding call the search tool makes.

Searching and indexing are different operations, and for some providers the same text must be embedded differently for each. Gemini Embedding 2 is the clearest case: it conditions the vector on what the text is for and requires that to be stated, so a Gemini embedding client could not serve a vector store at all until these options existed — a retrieval-query task belongs here and a retrieval-document task on upsert_embedding_options. For providers that draw no such distinction, leaving both unset is right, and is exactly what happened before.

Rust analogue of upstream’s per-operation embeddings_options (#8798). Split by operation rather than by field, because one provider has one vector field and it is the operation that differs.

dimensions is taken from the vector field’s declaration; passing a conflicting value here is an error at build rather than a store rejection — or worse, a silently mis-shaped vector — at the first call.

Source

pub fn upsert_embedding_options( self, options: EmbeddingGenerationOptions, ) -> VectorCollectionContextProviderBuilder

Provider options for the embedding call the upsert tool makes.

See search_embedding_options; this is the indexing side, where a retrieval-document task belongs.

Source

pub fn additional_tool( self, tool: ToolDefinition, ) -> VectorCollectionContextProviderBuilder

Add a caller-built tool alongside the generated ones.

These are passed through untouched — in particular the scope filter is not applied to them, so a tool that searches a shared collection has to carry its own.

Source

pub fn build(self) -> Result<VectorCollectionContextProvider, Error>

Validate the configuration and build the provider.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more