unsloth/tests/python
Roland Tannous 2093fb1608 Studio: swap RAG vector store from Qdrant to sqlite-vec
asg017/sqlite-vec is Apache-2.0 and OSI-approved. Replaces
qdrant-client (~30 MB) with a small SQLite extension loaded into a
dedicated rag.db file. Single file holds RAG vectors; bm25s indexes
and chat-side studio.db are unaffected.

- New core/rag/db.py owns the rag.db connection and sqlite-vec load.
  Extension load runs once at first open. Process-wide singleton
  protected by a lock; check_same_thread=False + WAL handles the
  FastAPI thread pool.
- core/rag/vector_store.py keeps the same public API
  (ensure_collection / upsert_chunks / search / collection_exists /
  delete_scope / delete_document) so callers in routes/rag.py,
  core/rag/ingestion.py, core/rag/tool.py, and core/rag/retrieval.py
  don't change. ensure_collection is now a no-op; collection_exists
  returns True iff the scope has at least one indexed vector.
- search uses sqlite-vec's vec_distance_cosine and converts distance
  to similarity in [0, 1] so the per-scope min_score threshold
  semantics stay identical.
- Mixed-dim scopes coexist behind WHERE scope = ? — the per-scope
  embedder resolver guarantees one embedder per scope.
- requirements/rag.txt swaps qdrant-client for sqlite-vec.
- utils/paths/storage_roots.py drops rag_vectordb_root() (the old
  qdrant directory); rag.db lives directly under rag_root().
- Rewritten tests/python/test_rag_vector_store.py for the new
  semantics (collection_exists tracks populated scopes; new tests
  for filtered search and upsert conflict resolution).

Python build requirement: connection.enable_load_extension(True)
must be available. install.sh creates the venv via uv-managed
python-build-standalone, which is compiled with
--enable-loadable-sqlite-extensions, so this works on standard
installs. core/rag/db.py raises an actionable error on the rare
custom-interpreter case.
2026-05-25 15:13:59 +04:00
..
__init__.py Consolidate dual venvs and separate install from update (#4530) 2026-03-25 05:24:21 -07:00
conftest.py fix: add tokenizers to no-torch deps and TORCH_CONSTRAINT for arm64 macOS py313+ (#4748) 2026-04-01 06:12:17 -07:00
test_cross_platform_parity.py Add configurable PyTorch mirror via UNSLOTH_PYTORCH_MIRROR env var (#5024) 2026-04-15 11:39:11 +04:00
test_dpo_vision_processor_passthrough.py Fix DPO trainer multi process hang (#5199) 2026-04-29 04:15:34 -07:00
test_e2e_no_torch_sandbox.py tests: add no-torch / Intel Mac test suite (#4646) 2026-03-27 02:33:45 -07:00
test_fast_sentence_transformer_redirect_lifecycle.py Add Studio PR-time CI: pin enforcement, frontend, backend, wheel smoke (#5298) 2026-05-06 04:41:57 -07:00
test_flash_attn_install_python_stack.py studio: skip flash-attn install on Blackwell GPUs (sm_100+) (#5420) 2026-05-14 18:13:50 +04:00
test_gpu_init_ldconfig_guard.py feat(studio): MLX training tab on Apple Silicon (LoRA / full FT, VLM, export) (#5265) 2026-05-05 23:54:58 -07:00
test_install_python_stack.py Consolidate dual venvs and separate install from update (#4530) 2026-03-25 05:24:21 -07:00
test_no_torch_filtering.py [Studio] Install flash attn at setup time for linux (#4979) 2026-04-14 16:40:17 +04:00
test_orpo_processor_text_tokenizer.py Fix ORPO text-only tokenization with processors (#5501) 2026-05-18 00:40:30 -07:00
test_patch_trl_rl_trainers_defensive.py fix: unblock 4 tests deselected/skipped in #5312 (real bugs) (#5359) 2026-05-11 02:39:17 -07:00
test_rag_bm25.py Studio: add RAG with hybrid search, reranker, chat integration 2026-05-23 18:46:15 +04:00
test_rag_chunking.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-05-25 06:39:01 +00:00
test_rag_late_chunking.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-05-25 06:39:01 +00:00
test_rag_multimodal.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-05-25 06:39:01 +00:00
test_rag_multimodal_integration.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-05-25 06:39:01 +00:00
test_rag_parsers.py Studio: layout-aware RAG parsers + heading-aware chunking (Phase 3A) 2026-05-24 11:10:13 +04:00
test_rag_reingest.py Studio: re-ingest existing KBs / threads with new settings (Backfill UX) 2026-05-24 12:41:55 +04:00
test_rag_reranker.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-05-25 06:39:01 +00:00
test_rag_retrieval.py Studio: add RAG with hybrid search, reranker, chat integration 2026-05-23 18:46:15 +04:00
test_rag_tool_handler.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-05-25 06:39:01 +00:00
test_rag_vector_store.py Studio: swap RAG vector store from Qdrant to sqlite-vec 2026-05-25 15:13:59 +04:00
test_studio_import_no_torch.py tests: add no-torch / Intel Mac test suite (#4646) 2026-03-27 02:33:45 -07:00
test_tokenizers_and_torch_constraint.py fix: add tokenizers to no-torch deps and TORCH_CONSTRAINT for arm64 macOS py313+ (#4748) 2026-04-01 06:12:17 -07:00
test_unsloth_run_tool_policy_resolver.py unsloth run: add --enable-tools/--disable-tools server-side tool policy (#5277) 2026-05-05 12:45:15 +04:00