pub struct EmbeddingStore { /* private fields */ }Implementations§
Source§impl EmbeddingStore
impl EmbeddingStore
Sourcepub fn new(url: &str, pool: SqlitePool) -> Result<Self, MemoryError>
pub fn new(url: &str, pool: SqlitePool) -> Result<Self, MemoryError>
Create a new EmbeddingStore connected to the given Qdrant URL.
The pool is used for SQLite metadata operations on the embeddings_metadata
table (which must already exist via sqlx migrations).
§Errors
Returns an error if the Qdrant client cannot be created.
pub fn with_store(store: Box<dyn VectorStore>, pool: SqlitePool) -> Self
Sourcepub async fn ensure_collection(
&self,
vector_size: u64,
) -> Result<(), MemoryError>
pub async fn ensure_collection( &self, vector_size: u64, ) -> Result<(), MemoryError>
Ensure the collection exists in Qdrant with the given vector size.
Idempotent: no-op if the collection already exists.
§Errors
Returns an error if Qdrant cannot be reached or collection creation fails.
Sourcepub async fn store(
&self,
message_id: MessageId,
conversation_id: ConversationId,
role: &str,
vector: Vec<f32>,
kind: MessageKind,
model: &str,
) -> Result<String, MemoryError>
pub async fn store( &self, message_id: MessageId, conversation_id: ConversationId, role: &str, vector: Vec<f32>, kind: MessageKind, model: &str, ) -> Result<String, MemoryError>
Store a vector in Qdrant and persist metadata to SQLite.
Returns the UUID of the newly created Qdrant point.
§Errors
Returns an error if the Qdrant upsert or SQLite insert fails.
Sourcepub async fn search(
&self,
query_vector: &[f32],
limit: usize,
filter: Option<SearchFilter>,
) -> Result<Vec<SearchResult>, MemoryError>
pub async fn search( &self, query_vector: &[f32], limit: usize, filter: Option<SearchFilter>, ) -> Result<Vec<SearchResult>, MemoryError>
Search for similar vectors in Qdrant, returning up to limit results.
§Errors
Returns an error if the Qdrant search fails.
Sourcepub async fn ensure_named_collection(
&self,
name: &str,
vector_size: u64,
) -> Result<(), MemoryError>
pub async fn ensure_named_collection( &self, name: &str, vector_size: u64, ) -> Result<(), MemoryError>
Ensure a named collection exists in Qdrant with the given vector size.
§Errors
Returns an error if Qdrant cannot be reached or collection creation fails.
Sourcepub async fn store_to_collection(
&self,
collection: &str,
payload: Value,
vector: Vec<f32>,
) -> Result<String, MemoryError>
pub async fn store_to_collection( &self, collection: &str, payload: Value, vector: Vec<f32>, ) -> Result<String, MemoryError>
Store a vector in a named Qdrant collection with arbitrary payload.
Returns the UUID of the newly created point.
§Errors
Returns an error if the Qdrant upsert fails.
Sourcepub async fn search_collection(
&self,
collection: &str,
query_vector: &[f32],
limit: usize,
filter: Option<VectorFilter>,
) -> Result<Vec<ScoredVectorPoint>, MemoryError>
pub async fn search_collection( &self, collection: &str, query_vector: &[f32], limit: usize, filter: Option<VectorFilter>, ) -> Result<Vec<ScoredVectorPoint>, MemoryError>
Search a named Qdrant collection, returning scored points with payloads.
§Errors
Returns an error if the Qdrant search fails.
Sourcepub async fn has_embedding(
&self,
message_id: MessageId,
) -> Result<bool, MemoryError>
pub async fn has_embedding( &self, message_id: MessageId, ) -> Result<bool, MemoryError>
Check whether an embedding already exists for the given message ID.
§Errors
Returns an error if the SQLite query fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EmbeddingStore
impl !RefUnwindSafe for EmbeddingStore
impl Send for EmbeddingStore
impl Sync for EmbeddingStore
impl Unpin for EmbeddingStore
impl UnsafeUnpin for EmbeddingStore
impl !UnwindSafe 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
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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request