Lukasz Boryn 0e0bae4b9b feat: initial public release of askme
* 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
2026-11-03 17:50:52 +01:00

147 lines
3.2 KiB
Markdown

---
type: Guide
purpose: Give the full command reference for running askme day to day.
answers:
- "Which command starts, ingests, queries, evaluates or tears down askme?"
cites:
- justfile
- src/askme/api/main.py
---
# askme — Usage Guide
LightRAG-powered Q&A over bioinformatics notebooks (scanpy, scRNA-seq, spatial transcriptomics).
## Prerequisites
- Docker + Docker Compose
- `just` (command runner)
- Sufficient disk for models (~5GB for qwen2.5:7b + nomic-embed-text)
---
## 1. Start the stack
```bash
just up
```
This starts Neo4j, Qdrant, Ollama, and the askme API container. Ollama models are pulled automatically on first start.
---
## 2. Ingest notebooks
### Full ingest
```bash
just ingest
```
Walks `data/notebook_archive/`, extracts text from `.ipynb`, `.Rmd`, `.py`, and `.R` files, deduplicates, and inserts into LightRAG. Entity extraction via LLM runs during insert — expect several hours for 700+ files.
```bash
just ingest --dry-run # list files that would be ingested without inserting
just ingest my-folder # ingest from data/my-folder/ instead
```
### Incremental ingest (new/changed files only)
```bash
just ingest-new
```
Uses `data/ingest_manifest.json` to track which files have been ingested. Only processes files that are new or whose content has changed since the last run.
### Re-ingesting from scratch
If you need to wipe and start over:
```bash
just clean-stores # wipes Neo4j, Qdrant, and LightRAG KV store (keeps Ollama models)
just up
just ingest
```
---
## 3. Query
### CLI
```bash
just query "What preprocessing steps are used for scRNA-seq data?"
```
Query modes (default: `hybrid`):
| Mode | Description |
|---|---|
| `hybrid` | Combines local and global graph traversal (recommended) |
| `local` | Answers from local entity neighbourhood |
| `global` | Answers from high-level graph summaries |
| `naive` | Direct vector similarity, no graph traversal |
```bash
docker compose exec askme uv run askme-query "What is UMAP?" --mode local
```
### API
```bash
just serve # starts FastAPI on port 8000 with reload
```
```bash
curl -X POST http://localhost:8000/query \
-H "Content-Type: application/json" \
-d '{"question": "How is cell clustering performed?", "mode": "hybrid"}'
```
Response:
```json
{
"answer": "...",
"sources": [
{"file": "notebooks/clustering.ipynb", "excerpt": "..."}
]
}
```
### Utility endpoints
```bash
curl http://localhost:8000/health # check Neo4j, Qdrant, Ollama reachability
curl http://localhost:8000/collections # chunk, entity, relationship counts in Qdrant
```
---
## 4. Evaluate
```bash
just eval
just eval --testset-size 20 --output data/eval_report.json
```
Generates a synthetic testset from ingested content, queries LightRAG, and scores with RAGAS (faithfulness, answer relevancy, context precision). Results are printed as a table and optionally saved as JSON.
---
## 5. Run tests
```bash
uv run pytest tests/
uv run pytest tests/ --cov=askme --cov-report=term-missing
```
---
## 6. Teardown
```bash
just down # stop all containers (preserves volumes)
just clean-stores # stop + wipe Neo4j, Qdrant, LightRAG KV store
just clean-all # stop + wipe everything including Ollama models
```