pub struct Client { /* private fields */ }Expand description
An async VectrixDB client.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(url: impl Into<String>) -> ClientBuilder
pub fn new(url: impl Into<String>) -> ClientBuilder
Start building a client for the server at url.
Sourcepub async fn ready(&self) -> Result<bool>
pub async fn ready(&self) -> Result<bool>
true when models are loaded. Falls back to health
on a server without /ready.
Sourcepub async fn whoami(&self) -> Result<Value>
pub async fn whoami(&self) -> Result<Value>
Who the key or token is, as the server’s data object.
pub async fn collections(&self) -> Result<Vec<Collection>>
pub async fn describe(&self, name: &str) -> Result<Collection>
pub async fn create_collection( &self, name: &str, options: CreateOptions, ) -> Result<Collection>
pub async fn delete_collection(&self, name: &str) -> Result<()>
Sourcepub async fn add_document(
&self,
collection: &str,
bytes: impl AsRef<[u8]>,
filename: &str,
options: AddOptions,
) -> Result<Added>
pub async fn add_document( &self, collection: &str, bytes: impl AsRef<[u8]>, filename: &str, options: AddOptions, ) -> Result<Added>
Upload a file’s bytes: the server reads, cuts, embeds and writes it.
Sourcepub async fn add_texts(&self, collection: &str, texts: Vec<Text>) -> Result<u64>
pub async fn add_texts(&self, collection: &str, texts: Vec<Text>) -> Result<u64>
Embed and store texts; returns how many were added.
pub async fn search( &self, collection: &str, query: &str, options: SearchOptions, ) -> Result<Vec<Hit>>
pub async fn documents(&self, collection: &str) -> Result<Vec<Document>>
Sourcepub async fn open_document(
&self,
collection: &str,
doc_id: &str,
) -> Result<String>
pub async fn open_document( &self, collection: &str, doc_id: &str, ) -> Result<String>
The Markdown the document was indexed from.
Sourcepub async fn delete_document(
&self,
collection: &str,
doc_id: &str,
) -> Result<u64>
pub async fn delete_document( &self, collection: &str, doc_id: &str, ) -> Result<u64>
Remove a document; returns how many chunks went with it.
pub async fn sources(&self, collection: &str) -> Result<Vec<Source>>
pub async fn add_source( &self, collection: &str, address: &str, options: SourceOptions, ) -> Result<Source>
Sourcepub async fn refresh_sources(&self, collection: &str) -> Result<Refreshed>
pub async fn refresh_sources(&self, collection: &str) -> Result<Refreshed>
Read the sources that are due and write what changed.
pub async fn delete_source( &self, collection: &str, source_id: &str, delete_documents: bool, ) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
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