pub struct NamespacedClient<'a> { /* private fields */ }Implementations§
Source§impl<'a> NamespacedClient<'a>
impl<'a> NamespacedClient<'a>
Sourcepub async fn upsert(&self, body: &Value) -> Result<UpsertResponse, Error>
pub async fn upsert(&self, body: &Value) -> Result<UpsertResponse, Error>
Upsert a vector into a namespace. This creates the namespace if it does not yet have any vectors.
Example:
use turbopuffer_client::Client;
let ns = Client::new("secret").namespace("test");
let vectors = serde_json::json!({
"ids": [1, 2, 3, 4],
"vectors": [[0.1, 0.1], [0.2, 0.2], [0.3, 0.3], [0.4, 0.4]],
"attributes": {
"my-string": ["one", null, "three", "four"],
"my-uint": [12, null, 84, 39],
"my-string-array": [["a", "b"], ["b", "d"], [], ["c"]]
}
});ⓘ
let res = ns.upsert(&vectors).await.unwrap();Sourcepub async fn query(&self, body: &Value) -> Result<QueryResponse, Error>
pub async fn query(&self, body: &Value) -> Result<QueryResponse, Error>
Query the namespace for matching vectors.
Example:
use turbopuffer_client::Client;
let ns = Client::new("secret").namespace("test");
let query = serde_json::json!({
"vector": [0.105, 0.1],
"distance_metric": "euclidean_squared",
"top_k": 1,
"include_vectors": true,
"include_attributes": ["my-string"],
});ⓘ
let res = ns.query(&query).await.unwrap();Auto Trait Implementations§
impl<'a> Freeze for NamespacedClient<'a>
impl<'a> !RefUnwindSafe for NamespacedClient<'a>
impl<'a> Send for NamespacedClient<'a>
impl<'a> Sync for NamespacedClient<'a>
impl<'a> Unpin for NamespacedClient<'a>
impl<'a> !UnwindSafe for NamespacedClient<'a>
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