Add RAGAS evaluation web console (FastAPI + vanilla JS)
- webapp/: FastAPI backend with runs/scenarios/evaluations API routers; services for run_reader, report_builder, scenario_scanner, task_manager (lazy ragas import — server boots even without ragas); Pydantic models - webapp/static/: single-page console (layout A: left-nav + main area); report detail with metric cards, Chart.js distribution histogram, grouping table, lowest-score sample review; trigger evaluation + log polling - webmain.py: uvicorn entry point (alongside existing main.py CLI) - start.bat: Windows one-click launcher with env checks and auto-browser open - rag_eval/datasets/: implement missing loader + normalizer modules (load_dataset_records, normalize_records) required by evaluator - scripts/seed_sample_run.py: generate realistic demo run artifacts - .gitignore: exclude datasets/ data files but keep rag_eval/datasets/ source Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
This commit is contained in:
42
webmain.py
Normal file
42
webmain.py
Normal file
@@ -0,0 +1,42 @@
|
||||
"""CLI entry point that launches the evaluation console web server.
|
||||
|
||||
Run alongside the existing main.py CLI; both share the same rag_eval library
|
||||
and the same runs/ artifacts. Example:
|
||||
|
||||
python webmain.py
|
||||
python webmain.py --host 0.0.0.0 --port 8800
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
|
||||
import uvicorn
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
"""Parse host/port/reload options for the console server."""
|
||||
parser = argparse.ArgumentParser(description="Launch the RAGAS evaluation console.")
|
||||
parser.add_argument("--host", default="127.0.0.1", help="Bind host (default 127.0.0.1).")
|
||||
parser.add_argument("--port", type=int, default=8800, help="Bind port (default 8800).")
|
||||
parser.add_argument(
|
||||
"--reload",
|
||||
action="store_true",
|
||||
help="Enable auto-reload for local development.",
|
||||
)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Start uvicorn with the configured application."""
|
||||
args = parse_args()
|
||||
uvicorn.run(
|
||||
"webapp.server:app",
|
||||
host=args.host,
|
||||
port=args.port,
|
||||
reload=args.reload,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user