ragbench-rag-eval / app /1111-main - Copy.py
Renangi's picture
Initial commit without secrets
c8dfbc0
raw
history blame contribute delete
831 Bytes
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"
@app.post("/run_domain")
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
@app.get("/health")
def health():
return {"status": "ok"}
@app.get("/")
def root():
return {
"message": "RAGBench RAG Evaluation API is running.",
"endpoints": {
"health": "/health",
"docs": "/docs",
"run_domain": "/run_domain (POST)",
},
}