diff --git a/studio/backend/core/rag/db.py b/studio/backend/core/rag/db.py index f5fc7ccb98..1cc7dcb34e 100644 --- a/studio/backend/core/rag/db.py +++ b/studio/backend/core/rag/db.py @@ -73,9 +73,7 @@ def _backfill_fts(conn: sqlite3.Connection) -> None: """One-time: seed FTS from existing vectors for rag.db files created before FTS5 replaced the on-disk bm25s index. Runs only when FTS is empty but vectors exist; idempotent thereafter.""" - fts_seeded = conn.execute( - "SELECT 1 FROM rag_chunks_fts LIMIT 1" - ).fetchone() + fts_seeded = conn.execute("SELECT 1 FROM rag_chunks_fts LIMIT 1").fetchone() if fts_seeded is not None: return has_vectors = conn.execute("SELECT 1 FROM rag_vectors LIMIT 1").fetchone() diff --git a/studio/backend/core/rag/vector_store.py b/studio/backend/core/rag/vector_store.py index 1a8c660b09..0ba1c52599 100644 --- a/studio/backend/core/rag/vector_store.py +++ b/studio/backend/core/rag/vector_store.py @@ -89,9 +89,7 @@ def upsert_chunks(scope: str, points: Iterable[dict]) -> None: rows, ) if fts_rows: - conn.executemany( - "DELETE FROM rag_chunks_fts WHERE chunk_id = ?", fts_delete - ) + conn.executemany("DELETE FROM rag_chunks_fts WHERE chunk_id = ?", fts_delete) conn.executemany( "INSERT INTO rag_chunks_fts (text, chunk_id, scope) VALUES (?, ?, ?)", fts_rows, diff --git a/tests/python/test_rag_bm25.py b/tests/python/test_rag_bm25.py index 303b47b9a0..f73ec58a6d 100644 --- a/tests/python/test_rag_bm25.py +++ b/tests/python/test_rag_bm25.py @@ -46,7 +46,9 @@ def test_lexical_search_roundtrip(isolated_rag_db): scope, [ _chunk("c1", "the quick brown fox jumps over the lazy dog", index = 0), - _chunk("c2", "machine learning models predict outputs from inputs", index = 1), + _chunk( + "c2", "machine learning models predict outputs from inputs", index = 1 + ), _chunk("c3", "fox terriers are small dogs", index = 2), ], )