Skip to main content

VectorizeVectorStore

Struct VectorizeVectorStore 

Source
pub struct VectorizeVectorStore<M> { /* private fields */ }
Expand description

A vector store backed by Cloudflare Vectorize.

This struct implements VectorStoreIndex to provide vector similarity search using Cloudflare’s globally distributed Vectorize service.

Implementations§

Source§

impl<M> VectorizeVectorStore<M>

Source

pub fn new( model: M, account_id: impl Into<String>, index_name: impl Into<String>, api_token: impl Into<String>, ) -> Self

Creates a new Vectorize vector store.

§Arguments
  • model - The embedding model to use for query embedding
  • account_id - Cloudflare account ID
  • index_name - Name of the Vectorize index
  • api_token - Cloudflare API token with Vectorize read permissions

Trait Implementations§

Source§

impl<M: Clone> Clone for VectorizeVectorStore<M>

Source§

fn clone(&self) -> VectorizeVectorStore<M>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<M: Debug> Debug for VectorizeVectorStore<M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<M> InsertDocuments for VectorizeVectorStore<M>
where M: EmbeddingModel + Sync + Send,

Source§

async fn insert_documents<Doc: Serialize + Embed + Send>( &self, documents: Vec<(Doc, OneOrMany<Embedding>)>, ) -> Result<(), VectorStoreError>

Source§

impl<M> VectorStoreIndex for VectorizeVectorStore<M>
where M: EmbeddingModel + Sync + Send,

Source§

type Filter = VectorizeFilter

The filter type for this backend.
Source§

async fn top_n<T: for<'a> Deserialize<'a> + Send>( &self, req: VectorSearchRequest<Self::Filter>, ) -> Result<Vec<(f64, String, T)>, VectorStoreError>

Returns the top N most similar documents as (score, id, document) tuples.
Source§

async fn top_n_ids( &self, req: VectorSearchRequest<Self::Filter>, ) -> Result<Vec<(f64, String)>, VectorStoreError>

Returns the top N most similar document IDs as (score, id) tuples.

Auto Trait Implementations§

§

impl<M> Freeze for VectorizeVectorStore<M>
where M: Freeze,

§

impl<M> !RefUnwindSafe for VectorizeVectorStore<M>

§

impl<M> Send for VectorizeVectorStore<M>
where M: Send,

§

impl<M> Sync for VectorizeVectorStore<M>
where M: Sync,

§

impl<M> Unpin for VectorizeVectorStore<M>
where M: Unpin,

§

impl<M> UnsafeUnpin for VectorizeVectorStore<M>
where M: UnsafeUnpin,

§

impl<M> !UnwindSafe for VectorizeVectorStore<M>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> 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: 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: 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, F> Tool for T
where F: SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + for<'de> Deserialize<'de>, T: VectorStoreIndex<Filter = F>,

Source§

const NAME: &'static str = "search_vector_store"

The name of the tool. This name should be unique.
Source§

type Error = VectorStoreError

The error type of the tool.
Source§

type Args = VectorSearchRequest<F>

The arguments type of the tool.
Source§

type Output = Vec<VectorStoreOutput>

The output type of the tool.
Source§

async fn definition(&self, _prompt: String) -> ToolDefinition

A method returning the tool definition. The user prompt can be used to tailor the definition to the specific use case.
Source§

async fn call( &self, args: <T as Tool>::Args, ) -> Result<<T as Tool>::Output, <T as Tool>::Error>

The tool execution method. Both the arguments and return value are a String since these values are meant to be the output and input of LLM models (respectively)
Source§

fn name(&self) -> String

A method returning the name of the tool.
Source§

impl<T> ToolDyn for T
where T: Tool,

Source§

fn name(&self) -> String

Source§

fn definition<'a>( &'a self, prompt: String, ) -> Pin<Box<dyn Future<Output = ToolDefinition> + Send + 'a>>

Source§

fn call<'a>( &'a self, args: String, ) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'a>>

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<I, F> VectorStoreIndexDyn for I
where I: VectorStoreIndex<Filter = F>, F: Debug + Clone + SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + Serialize + for<'de> Deserialize<'de> + 'static,

Source§

fn top_n<'a>( &'a self, req: VectorSearchRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<(f64, String, Value)>, VectorStoreError>> + Send + 'a>>

Source§

fn top_n_ids<'a>( &'a self, req: VectorSearchRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<(f64, String)>, VectorStoreError>> + Send + 'a>>

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
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
Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,