* local question answering over analysis notebooks with LightRAG, Neo4j, Qdrant and Ollama * RAGAS evaluation with a generator x judge comparison matrix, fully local * docs in README and OKF
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
"""Shared pytest fixtures for askme tests."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
from unittest.mock import AsyncMock, MagicMock
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_chunks() -> list[str]:
|
|
"""Small text chunks representative of notebook content."""
|
|
return [
|
|
"# Notebook: scanpy_tutorial.ipynb\n\nScanpy is a Python library for "
|
|
"single-cell analysis. It provides tools for preprocessing, "
|
|
"visualization, clustering, and trajectory inference.",
|
|
"# Script: preprocess.py\n\nimport scanpy as sc\n\nadata = sc.read_h5ad('data.h5ad')\n"
|
|
"sc.pp.normalize_total(adata)\nsc.pp.log1p(adata)",
|
|
]
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_rag(tmp_path: Path) -> MagicMock:
|
|
"""LightRAG mock with async stubs for storage and query methods."""
|
|
rag = MagicMock()
|
|
rag.initialize_storages = AsyncMock()
|
|
rag.finalize_storages = AsyncMock()
|
|
rag.ainsert = AsyncMock()
|
|
rag.aquery = AsyncMock(
|
|
return_value=(
|
|
"Scanpy is used for single-cell RNA-seq analysis.\n\n"
|
|
"## Sources\n- scanpy_tutorial.ipynb: Scanpy is a Python library"
|
|
)
|
|
)
|
|
return rag
|