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>
impl<M> VectorizeVectorStore<M>
Sourcepub fn new(
model: M,
account_id: impl Into<String>,
index_name: impl Into<String>,
api_token: impl Into<String>,
) -> Self
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 embeddingaccount_id- Cloudflare account IDindex_name- Name of the Vectorize indexapi_token- Cloudflare API token with Vectorize read permissions
Trait Implementations§
Source§impl<M: Clone> Clone for VectorizeVectorStore<M>
impl<M: Clone> Clone for VectorizeVectorStore<M>
Source§fn clone(&self) -> VectorizeVectorStore<M>
fn clone(&self) -> VectorizeVectorStore<M>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<M: Debug> Debug for VectorizeVectorStore<M>
impl<M: Debug> Debug for VectorizeVectorStore<M>
Source§impl<M> InsertDocuments for VectorizeVectorStore<M>
impl<M> InsertDocuments for VectorizeVectorStore<M>
Source§impl<M> VectorStoreIndex for VectorizeVectorStore<M>
impl<M> VectorStoreIndex for VectorizeVectorStore<M>
Source§type Filter = VectorizeFilter
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>
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>
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T, F> Tool for Twhere
F: SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + for<'de> Deserialize<'de>,
T: VectorStoreIndex<Filter = F>,
impl<T, F> Tool for Twhere
F: SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + for<'de> Deserialize<'de>,
T: VectorStoreIndex<Filter = F>,
Source§const NAME: &'static str = "search_vector_store"
const NAME: &'static str = "search_vector_store"
The name of the tool. This name should be unique.
Source§type Error = VectorStoreError
type Error = VectorStoreError
The error type of the tool.
Source§type Args = VectorSearchRequest<F>
type Args = VectorSearchRequest<F>
The arguments type of the tool.
Source§type Output = Vec<VectorStoreOutput>
type Output = Vec<VectorStoreOutput>
The output type of the tool.
Source§async fn definition(&self, _prompt: String) -> ToolDefinition
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.