pub struct VectorStoresClient<'a, T = ()> { /* private fields */ }Expand description
Client for vector stores API.
Implementations§
Source§impl<T: Default + Send + Sync> VectorStoresClient<'_, T>
impl<T: Default + Send + Sync> VectorStoresClient<'_, T>
Sourcepub async fn create(
&self,
builder: VectorStoreBuilder,
) -> Result<VectorStoreObject>
pub async fn create( &self, builder: VectorStoreBuilder, ) -> Result<VectorStoreObject>
Create a new vector store.
§Example
ⓘ
use openai_ergonomic::Client;
use openai_ergonomic::builders::vector_stores::VectorStoreBuilder;
let client = Client::from_env()?;
let builder = VectorStoreBuilder::new()
.name("My Knowledge Base")
.add_file("file-123");
let vector_store = client.vector_stores().create(builder).await?;
println!("Created vector store: {}", vector_store.id);Sourcepub async fn list(
&self,
limit: Option<i32>,
order: Option<&str>,
after: Option<&str>,
before: Option<&str>,
) -> Result<ListVectorStoresResponse>
pub async fn list( &self, limit: Option<i32>, order: Option<&str>, after: Option<&str>, before: Option<&str>, ) -> Result<ListVectorStoresResponse>
Sourcepub async fn update(
&self,
vector_store_id: impl Into<String>,
builder: VectorStoreBuilder,
) -> Result<VectorStoreObject>
pub async fn update( &self, vector_store_id: impl Into<String>, builder: VectorStoreBuilder, ) -> Result<VectorStoreObject>
Update a vector store.
§Example
ⓘ
use openai_ergonomic::Client;
use openai_ergonomic::builders::vector_stores::VectorStoreBuilder;
let client = Client::from_env()?;
let builder = VectorStoreBuilder::new()
.name("Updated Name")
.metadata("updated", "true");
let vector_store = client.vector_stores().update("vs_123", builder).await?;
println!("Updated: {}", vector_store.name);Sourcepub async fn delete(
&self,
vector_store_id: impl Into<String>,
) -> Result<DeleteVectorStoreResponse>
pub async fn delete( &self, vector_store_id: impl Into<String>, ) -> Result<DeleteVectorStoreResponse>
Sourcepub async fn add_file(
&self,
vector_store_id: impl Into<String>,
file_id: impl Into<String>,
) -> Result<VectorStoreFileObject>
pub async fn add_file( &self, vector_store_id: impl Into<String>, file_id: impl Into<String>, ) -> Result<VectorStoreFileObject>
Sourcepub async fn list_files(
&self,
vector_store_id: impl Into<String>,
limit: Option<i32>,
order: Option<&str>,
after: Option<&str>,
before: Option<&str>,
filter: Option<&str>,
) -> Result<ListVectorStoreFilesResponse>
pub async fn list_files( &self, vector_store_id: impl Into<String>, limit: Option<i32>, order: Option<&str>, after: Option<&str>, before: Option<&str>, filter: Option<&str>, ) -> Result<ListVectorStoreFilesResponse>
Sourcepub async fn get_file(
&self,
vector_store_id: impl Into<String>,
file_id: impl Into<String>,
) -> Result<VectorStoreFileObject>
pub async fn get_file( &self, vector_store_id: impl Into<String>, file_id: impl Into<String>, ) -> Result<VectorStoreFileObject>
Sourcepub async fn delete_file(
&self,
vector_store_id: impl Into<String>,
file_id: impl Into<String>,
) -> Result<DeleteVectorStoreFileResponse>
pub async fn delete_file( &self, vector_store_id: impl Into<String>, file_id: impl Into<String>, ) -> Result<DeleteVectorStoreFileResponse>
Sourcepub async fn search(
&self,
builder: VectorStoreSearchBuilder,
) -> Result<VectorStoreSearchResultsPage>
pub async fn search( &self, builder: VectorStoreSearchBuilder, ) -> Result<VectorStoreSearchResultsPage>
Search a vector store.
§Example
ⓘ
use openai_ergonomic::Client;
use openai_ergonomic::builders::vector_stores::VectorStoreSearchBuilder;
let client = Client::from_env()?;
let builder = VectorStoreSearchBuilder::new("vs_123", "machine learning concepts");
let results = client.vector_stores().search(builder).await?;
println!("Found {} results", results.data.len());Trait Implementations§
Source§impl<'a, T: Clone> Clone for VectorStoresClient<'a, T>
impl<'a, T: Clone> Clone for VectorStoresClient<'a, T>
Source§fn clone(&self) -> VectorStoresClient<'a, T>
fn clone(&self) -> VectorStoresClient<'a, T>
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<'a, T: Debug> Debug for VectorStoresClient<'a, T>
impl<'a, T: Debug> Debug for VectorStoresClient<'a, T>
impl<'a, T: Copy> Copy for VectorStoresClient<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for VectorStoresClient<'a, T>
impl<'a, T = ()> !RefUnwindSafe for VectorStoresClient<'a, T>
impl<'a, T> Send for VectorStoresClient<'a, T>
impl<'a, T> Sync for VectorStoresClient<'a, T>
impl<'a, T> Unpin for VectorStoresClient<'a, T>
impl<'a, T = ()> !UnwindSafe for VectorStoresClient<'a, T>
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