Research codebase for OPIS (IVF outcome prediction) plus a RAG assistant that answers questions using retrieved documents and the user’s prediction context.
| Path | Purpose |
|---|---|
apps/ |
Streamlit UIs — see apps/README.md for each app |
src/ |
Streamlit entry shims (app*.py → apps/), logs, vignette JSON, package root for imports |
src/opisbot/ |
Backend package — domain (prediction), RAG pipeline, config loaders, evaluation batch runner |
configs/ |
YAML templates for RAG models, batch eval, judges, app hints |
data/ |
Source documents for ingestion / indexing |
embeddings_test_HG/ |
Default FAISS index (created or updated by ingestion) |
evaluation/ |
Batch scripts (openai_run.py, ollama_run.py), sample datasets |
-
Environment
uv sync source .venv/bin/activate # optional export OPENAI_API_KEY=...
-
Run a Streamlit app (from repo root)
streamlit run apps/opis_chat.py
Other UIs:
apps/README.md. -
Batch evaluation (RAG + optional LLM/rule judges)
PYTHONPATH=src python evaluation/openai_run.py --eval-config configs/eval/default_batch.yaml
Skip extra judge API calls:
--no-judges. Ollama single-turn:evaluation/ollama_run.py(see that file’s docstring). -
Intent classification eval (lookup vs
data/feature_category.json, separate from LLM judges)PYTHONPATH=src python evaluation/run_intent_eval.py
RAG chat uses the same lookup for routing: OOD-led vs in-distribution-led retrieval over the pooled FAISS index (see
configs/rag/baseline.yaml→intent).
- Canonical backend lives in
src/opisbot/(pipeline, prompts, retriever, prediction). UIs importopisbotafter addingsrctosys.path. - Migration: Duplicate modules (
src/RAG.py,src/retriever.py,src/OPISpredict.py, oldrag_pipeline*.py,doc_index.py, and copies underevaluation/multiturn_human/) have been removed. Useopisbot.core.rag.pipeline,opisbot.core.domain.prediction, andopisbot.core.rag.retrieverinstead. - Paths: RAG resolves
data/and index dirs relative to the repository root (not the process working directory).
configs/rag/*.yaml— LLM provider/model, retrievalk, embedding id, optionalpathsoverrides.configs/eval/default_batch.yaml— points at a RAG config, JSONL dataset, and judge file.configs/eval/judges.yaml— LLM rubric judges + rule-based checks.
- App-specific behaviour and run commands:
apps/README.md evaluation/multiturn_human/app.py(human-in-the-loop simulation) now uses the sameopisbotstack; run it withsrconPYTHONPATHor from a cwd where the app’s bootstrap finds the repo.
Use and deployment are your responsibility; ensure compliance with clinical, data-protection, and API terms for your environment.