pub struct VectorizeClient { /* private fields */ }Expand description
HTTP client wrapper for Vectorize API operations.
Implementations§
Source§impl VectorizeClient
impl VectorizeClient
Sourcepub fn new(
account_id: impl Into<String>,
index_name: impl Into<String>,
api_token: impl Into<String>,
) -> Self
pub fn new( account_id: impl Into<String>, index_name: impl Into<String>, api_token: impl Into<String>, ) -> Self
Creates a new Vectorize client.
§Arguments
account_id- Cloudflare account IDindex_name- Name of the Vectorize indexapi_token- Cloudflare API token with Vectorize permissions
Sourcepub async fn query(
&self,
request: QueryRequest,
) -> Result<QueryResult, VectorizeError>
pub async fn query( &self, request: QueryRequest, ) -> Result<QueryResult, VectorizeError>
Performs a vector similarity query.
Sourcepub async fn upsert(
&self,
request: UpsertRequest,
) -> Result<UpsertResult, VectorizeError>
pub async fn upsert( &self, request: UpsertRequest, ) -> Result<UpsertResult, VectorizeError>
Upserts vectors (inserts or updates if ID already exists).
This is the preferred method for inserting documents as it’s idempotent. Up to 5000 vectors can be upserted per request via the HTTP API.
Sourcepub async fn delete_by_ids(
&self,
ids: Vec<String>,
) -> Result<DeleteResult, VectorizeError>
pub async fn delete_by_ids( &self, ids: Vec<String>, ) -> Result<DeleteResult, VectorizeError>
Deletes vectors by their IDs.
Up to 1000 vector IDs can be deleted per request.
Sourcepub async fn list_vectors(
&self,
limit: Option<u32>,
cursor: Option<&str>,
) -> Result<ListVectorsResult, VectorizeError>
pub async fn list_vectors( &self, limit: Option<u32>, cursor: Option<&str>, ) -> Result<ListVectorsResult, VectorizeError>
Lists vector IDs in the index (paginated).
Returns up to limit vector IDs (max 1000, default 100).
Use the next_cursor from the response to fetch the next page.
Trait Implementations§
Source§impl Clone for VectorizeClient
impl Clone for VectorizeClient
Source§fn clone(&self) -> VectorizeClient
fn clone(&self) -> VectorizeClient
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 moreAuto Trait Implementations§
impl Freeze for VectorizeClient
impl !RefUnwindSafe for VectorizeClient
impl Send for VectorizeClient
impl Sync for VectorizeClient
impl Unpin for VectorizeClient
impl UnsafeUnpin for VectorizeClient
impl !UnwindSafe for VectorizeClient
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