Principle:Protectai Llm guard Scanner Configuration Schema
| Knowledge Sources | |
|---|---|
| Domains | Configuration, API_Design, DevOps |
| Last Updated | 2026-02-14 12:00 GMT |
Overview
A YAML-based declarative configuration pattern that defines scanner pipelines, authentication, rate limiting, and observability settings for the LLM Guard API server.
Description
The scanner configuration schema enables declarative definition of the entire LLM Guard API server behavior through a single YAML file. It uses Pydantic models for validation and supports environment variable substitution via ${ENV_VAR:default} syntax.
The configuration covers:
- Scanner pipelines: Ordered lists of input and output scanners with per-scanner parameters.
- Application settings: Log level, fail-fast mode, timeouts, lazy loading.
- Authentication: HTTP Bearer or HTTP Basic authentication.
- Rate limiting: Request rate limits with enable/disable toggle.
- Observability: OpenTelemetry tracing and metrics exporter configuration.
Usage
Use this principle when deploying LLM Guard as a production API service. The YAML configuration file is the single source of truth for the server's behavior, loaded at startup via the CONFIG_FILE environment variable.
Theoretical Basis
# Pseudocode for configuration loading
yaml_content = load_yaml(config_file) # With env var substitution
config = Config(**yaml_content) # Pydantic validation
scanners = instantiate_scanners(config) # Create scanner instances
app = create_fastapi_app(config, scanners) # Wire up routes