2. Install the SDK
Decorator Pattern
Use the@guarded_chat_completion
decorator for automatic guardrail evaluation:
Processing Modes
Parallel Processing (Default) - Guardrails run concurrently with LLM:Context Manager Pattern
UseHaliosGuard
for manual control over guardrail evaluation:
Key Features
- Flexible Processing: Parallel (faster) or sequential (safer) modes
- Async Support: Full asyncio compatibility with OpenAI client
- Minimal Changes: Decorator requires almost no code modification
- Manual Control: Context manager gives full evaluation control
- Error Handling: Comprehensive error management and logging
Examples
See the SDK examples for different implementation patterns:- Basic Usage - Decorator patterns and processing modes
- Context Manager - Manual evaluation control
- Streaming Response - Evaluate guardrails on streaming response
- Tool Calling - Guardrail evaluation with tool calling
- Validating Tool Input & Output - Evaluate guardrails on tool output