pub struct MockEmbedder { /* private fields */ }Expand description
测试用 Mock Embedder
Implementations§
Source§impl MockEmbedder
impl MockEmbedder
Sourcepub fn expect_embed(
&mut self,
inputs: Vec<&str>,
outputs: Vec<Vec<f32>>,
) -> &mut Self
pub fn expect_embed( &mut self, inputs: Vec<&str>, outputs: Vec<Vec<f32>>, ) -> &mut Self
设置期望输入和返回输出
Sourcepub fn set_error(&mut self, error: EmbedError)
pub fn set_error(&mut self, error: EmbedError)
设置应返回的错误
Sourcepub fn set_output(&mut self, vectors: Vec<Vec<f32>>)
pub fn set_output(&mut self, vectors: Vec<Vec<f32>>)
直接设置返回向量
Trait Implementations§
Source§impl Debug for MockEmbedder
impl Debug for MockEmbedder
Source§impl EmbeddingModel for MockEmbedder
impl EmbeddingModel for MockEmbedder
Source§fn embed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
input: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, EmbedError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
input: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, EmbedError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
核心嵌入方法。对一批文本生成向量。
Source§fn model_info(&self) -> &EmbedModelInfo
fn model_info(&self) -> &EmbedModelInfo
模型信息
Source§fn max_batch_size(&self) -> usize
fn max_batch_size(&self) -> usize
最大批次大小
Source§fn dimensions(&self) -> usize
fn dimensions(&self) -> usize
向量维度
Auto Trait Implementations§
impl !Freeze for MockEmbedder
impl RefUnwindSafe for MockEmbedder
impl Send for MockEmbedder
impl Sync for MockEmbedder
impl Unpin for MockEmbedder
impl UnsafeUnpin for MockEmbedder
impl UnwindSafe for MockEmbedder
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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