Spaces:
Running
Running
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| from ragbench_eval.pipeline import RagBenchExperiment | |
| app = FastAPI(title="RAGBench RAG Evaluation API") | |
| class RunRequest(BaseModel): | |
| domain: str | |
| k: int = 3 | |
| max_examples: int = 20 | |
| split: str = "test" | |
| def run_domain(req: RunRequest): | |
| exp = RagBenchExperiment( | |
| k=req.k, | |
| max_examples=req.max_examples, | |
| split=req.split, | |
| ) | |
| result = exp.run_domain(req.domain) | |
| return result | |
| def health(): | |
| return {"status": "ok"} | |
| def root(): | |
| return { | |
| "message": "RAGBench RAG Evaluation API is running.", | |
| "endpoints": { | |
| "health": "/health", | |
| "docs": "/docs", | |
| "run_domain": "/run_domain (POST)", | |
| }, | |
| } | |