pub struct EmbeddingService<S, E>where
S: DatasetStore,
E: EmbeddingProvider,{ /* private fields */ }Expand description
Standalone service for generating embeddings for datasets already in the database.
Queries datasets with embedding IS NULL, generates embeddings in batches
through a circuit breaker, and upserts them back to the database.
Implementations§
Source§impl<S, E> EmbeddingService<S, E>where
S: DatasetStore,
E: EmbeddingProvider,
impl<S, E> EmbeddingService<S, E>where
S: DatasetStore,
E: EmbeddingProvider,
Sourcepub fn new(store: S, embedding: E) -> Self
pub fn new(store: S, embedding: E) -> Self
Creates a new embedding service with default configuration.
Sourcepub fn with_config(
store: S,
embedding: E,
config: EmbeddingServiceConfig,
) -> Self
pub fn with_config( store: S, embedding: E, config: EmbeddingServiceConfig, ) -> Self
Creates a new embedding service with custom configuration.
Sourcepub fn embedding_provider(&self) -> &E
pub fn embedding_provider(&self) -> &E
Returns a reference to the underlying embedding provider.
Sourcepub async fn embed_pending(
&self,
portal_filter: Option<&str>,
reporter: &impl ProgressReporter,
cancel_token: CancellationToken,
) -> Result<EmbeddingStats, AppError>
pub async fn embed_pending( &self, portal_filter: Option<&str>, reporter: &impl ProgressReporter, cancel_token: CancellationToken, ) -> Result<EmbeddingStats, AppError>
Embeds all datasets with embedding IS NULL.
Fetches pending datasets from the database, generates embeddings in batches through the circuit breaker, and upserts them back.
§Arguments
portal_filter- Optional portal URL to scope the embedding passreporter- Progress reporter for UI/loggingcancel_token- Token for graceful cancellation
Trait Implementations§
Source§impl<S, E> Clone for EmbeddingService<S, E>
impl<S, E> Clone for EmbeddingService<S, E>
Auto Trait Implementations§
impl<S, E> Freeze for EmbeddingService<S, E>
impl<S, E> RefUnwindSafe for EmbeddingService<S, E>where
S: RefUnwindSafe,
E: RefUnwindSafe,
impl<S, E> Send for EmbeddingService<S, E>
impl<S, E> Sync for EmbeddingService<S, E>
impl<S, E> Unpin for EmbeddingService<S, E>
impl<S, E> UnsafeUnpin for EmbeddingService<S, E>where
S: UnsafeUnpin,
E: UnsafeUnpin,
impl<S, E> UnwindSafe for EmbeddingService<S, E>where
S: UnwindSafe,
E: UnwindSafe,
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