Spaces:
Sleeping
Sleeping
File size: 645 Bytes
826f9a4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
from pydantic import BaseModel
class OutputGuardrailsConfig(BaseModel):
contextual_grounding: bool = True
toxicity: bool = True
# Extend with more flags for additional guardrails
# Define the input that went to LLM and its response.
class LLMResponse(BaseModel):
question: str
answer: str
context: str
# GaurdRail Check Input Model
class CheckRequest(BaseModel):
llm_response: LLMResponse
config: OutputGuardrailsConfig = OutputGuardrailsConfig() # Default config if not provided
# GaurdRail Check Response
class CheckResponse(BaseModel):
grounded: bool
details: dict
|