llmgaurdrails / app.py
Sasidhar's picture
Update app.py
e1685b7 verified
raw
history blame
641 Bytes
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
import re
from gaurdrails_manager import GuardrailsManager
app = FastAPI()
# Define the POST endpoint for guardrail checking.
@app.post("/guardrails/check", response_model=CheckResponse)
async def check_guardrails(request: CheckRequest):
manager = GuardrailsManager(request.config)
result = manager.check(request.response)
return CheckResponse(grounded=result.grounded(), details=result.details)
@app.get("/")
def home():
return {"Msg": "This is a LLM Gaurdrails!"}
@app.get("/gaurdrails/test")
def test():
return {"Msg": "This is a Test!"}