pub struct Builder { /* private fields */ }Expand description
Builds one index in three steps: create, then select_representatives
or select_representatives_custom, then build. One build per Builder.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn new(
store: ReadableWritableListableStorage,
levels: u32,
metric: Metric,
is_normalized: bool,
memory_limit_bytes: usize,
embedding_dtype: Option<EmbeddingDtype>,
chunks: ChunkSizes,
) -> Result<Self>
pub fn new( store: ReadableWritableListableStorage, levels: u32, metric: Metric, is_normalized: bool, memory_limit_bytes: usize, embedding_dtype: Option<EmbeddingDtype>, chunks: ChunkSizes, ) -> Result<Self>
Starts a build in store instead of a path. Otherwise the same as Self::create.
Sourcepub fn create(
index_path: &Path,
levels: u32,
metric: Metric,
is_normalized: bool,
memory_limit_bytes: usize,
embedding_dtype: Option<EmbeddingDtype>,
chunks: ChunkSizes,
) -> Result<Self>
pub fn create( index_path: &Path, levels: u32, metric: Metric, is_normalized: bool, memory_limit_bytes: usize, embedding_dtype: Option<EmbeddingDtype>, chunks: ChunkSizes, ) -> Result<Self>
Creates an index at index_path. levels is the number of node levels
below the root. Set is_normalized only if every embedding is unit-length,
and leave embedding_dtype as None to keep each source’s own dtype.
Sourcepub fn select_representatives(
&mut self,
source: &EmbeddingsSource,
target_cluster_items: usize,
strategy: RepresentativeStrategy,
fallback_batch_vecs: usize,
) -> Result<()>
pub fn select_representatives( &mut self, source: &EmbeddingsSource, target_cluster_items: usize, strategy: RepresentativeStrategy, fallback_batch_vecs: usize, ) -> Result<()>
Picks the representatives the tree is built from, chosen by
strategy. target_cluster_items is the average cluster size it aims for, and
fallback_batch_vecs is the chunk size assumed when source isn’t chunked.
Auto Trait Implementations§
impl !RefUnwindSafe for Builder
impl !UnwindSafe for Builder
impl Freeze for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnsafeUnpin for Builder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more