Trait rig::embeddings::EmbeddingModel
source · pub trait EmbeddingModel:
Clone
+ Sync
+ Send {
const MAX_DOCUMENTS: usize;
// Required method
fn embed_documents(
&self,
documents: Vec<String>,
) -> impl Future<Output = Result<Vec<Embedding>, EmbeddingError>> + Send;
// Provided method
fn embed_document(
&self,
document: &str,
) -> impl Future<Output = Result<Embedding, EmbeddingError>> + Send
where Self: Sync { ... }
}
Expand description
Trait for embedding models that can generate embeddings for documents.
Required Associated Constants§
sourceconst MAX_DOCUMENTS: usize
const MAX_DOCUMENTS: usize
The maximum number of documents that can be embedded in a single request.
Required Methods§
sourcefn embed_documents(
&self,
documents: Vec<String>,
) -> impl Future<Output = Result<Vec<Embedding>, EmbeddingError>> + Send
fn embed_documents( &self, documents: Vec<String>, ) -> impl Future<Output = Result<Vec<Embedding>, EmbeddingError>> + Send
Embed multiple documents in a single request
Provided Methods§
sourcefn embed_document(
&self,
document: &str,
) -> impl Future<Output = Result<Embedding, EmbeddingError>> + Sendwhere
Self: Sync,
fn embed_document(
&self,
document: &str,
) -> impl Future<Output = Result<Embedding, EmbeddingError>> + Sendwhere
Self: Sync,
Embed a single document
Object Safety§
This trait is not object safe.