Struct chromadb::v1::client::ChromaClient

source ·
pub struct ChromaClient { /* private fields */ }

Implementations§

source§

impl ChromaClient

source

pub fn new(_: ChromaClientOptions) -> ChromaClient

Create a new Chroma client with the given options.

  • Defaults to url: http://localhost:8000
source

pub fn create_collection( &self, name: &str, metadata: Option<Map<String, Value>>, get_or_create: bool ) -> Result<ChromaCollection>

Create a new collection with the given name and metadata.

§Arguments
  • name - The name of the collection to create
  • metadata - Optional metadata to associate with the collection. Must be a JSON object with keys and values that are either numbers, strings or floats.
  • get_or_create - If true, return the existing collection if it exists
§Errors
  • If the collection already exists and get_or_create is false
  • If the collection name is invalid
source

pub fn get_or_create_collection( &self, name: &str, metadata: Option<Map<String, Value>> ) -> Result<ChromaCollection>

Get or create a collection with the given name and metadata.

§Arguments
  • name - The name of the collection to get or create
  • metadata - Optional metadata to associate with the collection. Must be a JSON object with keys and values that are either numbers, strings or floats.
§Errors
  • If the collection name is invalid
source

pub fn list_collections(&self) -> Result<Vec<ChromaCollection>>

List all collections

source

pub fn get_collection(&self, name: &str) -> Result<ChromaCollection>

Get a collection with the given name.

§Arguments
  • name - The name of the collection to get
§Errors
  • If the collection name is invalid
  • If the collection does not exist
source

pub fn delete_collection(&self, name: &str) -> Result<()>

Delete a collection with the given name.

§Arguments
  • name - The name of the collection to delete
§Errors
  • If the collection name is invalid
  • If the collection does not exist
source

pub fn reset(&self) -> Result<bool>

Resets the database. This will delete all collections and entries.

source

pub fn version(&self) -> Result<String>

The version of Chroma

source

pub fn heartbeat(&self) -> Result<u64>

Get the current time in nanoseconds since epoch. Used to check if the server is alive.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.