pub struct EmbeddingStore(/* private fields */);Implementations§
Source§impl EmbeddingStore
impl EmbeddingStore
pub fn register_space( &self, space: EmbeddingSpace, ) -> Result<WriteReceipt<EmbeddingSpace>>
pub fn spaces(&self) -> Result<Vec<EmbeddingSpace>>
Sourcepub fn register_embedder<F: Embedder + 'static>(
&self,
space_id: &str,
embedder: F,
) -> Result<()>
pub fn register_embedder<F: Embedder + 'static>( &self, space_id: &str, embedder: F, ) -> Result<()>
把一个嵌入回调绑到一个向量空间。一个向量模型 = 一个向量空间。
Sourcepub fn register_embedder_with<F: Embedder + 'static>(
&self,
space_id: &str,
embedder: F,
options: EmbedderOptions,
) -> Result<()>
pub fn register_embedder_with<F: Embedder + 'static>( &self, space_id: &str, embedder: F, options: EmbedderOptions, ) -> Result<()>
注册即校验:用样本真跑一遍完整链路,产出不符该空间契约就拒绝绑定。
这样能挡住「回调绑错空间」「换模型后忘改 dimension」——它们若不在这里拒掉,
要等第一次写回时才报 invalid_vector,那时空间已经建好、离原因很远。
Sourcepub fn embedder_space(&self, space_id: &str) -> Result<Option<EmbeddingSpace>>
pub fn embedder_space(&self, space_id: &str) -> Result<Option<EmbeddingSpace>>
该空间的定义;从未注册过该空间时返回 None。
pub fn unregister_embedder(&self, space_id: &str) -> Result<bool>
Sourcepub fn namespace_vectorization(&self, namespace: &str) -> Result<bool>
pub fn namespace_vectorization(&self, namespace: &str) -> Result<bool>
该 namespace 是否启用向量化。开关落盘,配置一次即生效。
pub fn set_namespace_vectorization( &self, namespace: &str, enabled: bool, ) -> Result<WriteReceipt<bool>>
Sourcepub fn vectorization(&self, namespace: &str, target: &str) -> Result<bool>
pub fn vectorization(&self, namespace: &str, target: &str) -> Result<bool>
某档开关在该领域下的取值;没设置过时给出该档的内置默认。
target 取 memory / graph / notes。
Sourcepub fn set_vectorization(
&self,
namespace: &str,
target: &str,
enabled: bool,
) -> Result<WriteReceipt<bool>>
pub fn set_vectorization( &self, namespace: &str, target: &str, enabled: bool, ) -> Result<WriteReceipt<bool>>
设置某档开关。只影响以后是否生成向量,已有向量保留在库里。
Sourcepub fn vector_ready(
&self,
namespace: &str,
space_id: &str,
target: &str,
) -> Result<bool>
pub fn vector_ready( &self, namespace: &str, space_id: &str, target: &str, ) -> Result<bool>
某领域的某一档在该空间下是否已补齐;target 取 memory / graph / notes。
未就绪的那一档,检索不让它的向量参与打分。
Sourcepub fn sync(
&self,
space_id: &str,
batch: usize,
) -> Result<WriteReceipt<SyncReport>>
pub fn sync( &self, space_id: &str, batch: usize, ) -> Result<WriteReceipt<SyncReport>>
内部同步:库拿该空间注册的回调,把缺失向量的记录分批补齐。宿主不参与。
它是四个触发时机里的「调用方主动叫一次」:先把索引追平(切片正文只存在索引里), 再把缺口补完,最后逐档核对缺口、把补齐的档标成就绪。 模型调用是网络往返,绝不能持有库锁,所以循环严格三段式: 读快照取一批文本(随即放锁)→ 调回调(不持任何库锁)→ 短事务写回这一批。 失败即中断:已写回的批次保留,未跑的批次不写。
pub fn delete_space(&self, id: &str) -> Result<WriteReceipt<bool>>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for EmbeddingStore
impl !UnwindSafe for EmbeddingStore
impl Freeze for EmbeddingStore
impl Send for EmbeddingStore
impl Sync for EmbeddingStore
impl Unpin for EmbeddingStore
impl UnsafeUnpin for EmbeddingStore
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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