File size: 458 Bytes
fbd111a
 
40383ad
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from pydantic import BaseModel

class GuardrailsConfig(BaseModel):
    factual_consistency: bool = True
    toxicity: bool = True
    # Extend with more flags for additional guardrails

# Request model now includes both the response and the configuration.
class CheckRequest(BaseModel):
    response: str
    config: GuardrailsConfig = GuardrailsConfig()  # Default config if not provided

class CheckResponse(BaseModel):
    grounded: bool
    details: dict