Skip to content

Commit

Permalink
Pass embedding model by ref
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrencev committed Nov 30, 2024
1 parent 6410809 commit 7ff68e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rig-sqlite/examples/vector_search_sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async fn main() -> Result<(), anyhow::Error> {
.await?;

// Initialize SQLite vector store
let mut vector_store = SqliteVectorStore::new(conn, model.clone()).await?;
let mut vector_store = SqliteVectorStore::new(conn, &model).await?;

// Add embeddings to vector store
match vector_store.add_documents(embeddings).await {
Expand Down
2 changes: 1 addition & 1 deletion rig-sqlite/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct SqliteVectorStore<E: EmbeddingModel> {
}

impl<E: EmbeddingModel> SqliteVectorStore<E> {
pub async fn new(conn: Connection, embedding_model: E) -> Result<Self, VectorStoreError> {
pub async fn new(conn: Connection, embedding_model: &E) -> Result<Self, VectorStoreError> {
// Run migrations or create tables if they don't exist
let dims = embedding_model.ndims();
conn.call(move |conn| {
Expand Down

0 comments on commit 7ff68e2

Please sign in to comment.