Appearance
Frequently Asked Questions (FAQ)
Common questions about elsai Guardrails.
General
What is elsai Guardrails?
elsai Guardrails is a Python library that adds programmable safety checks to LLM applications, including toxicity detection, sensitive data detection, and content classification.
What LLM providers are supported?
We support:
- OpenAI
- Azure OpenAI
- Anthropic Claude
- Google Gemini
- AWS Bedrock
Is it free to use?
The library is open source. You'll need API keys for the LLM providers you use.
Configuration
How do I configure guardrails?
You can configure guardrails using YAML files or YAML strings. See the Configuration Guide.
Can I use environment variables for API keys?
Yes, you can use environment variables for API keys. See the Configuration Guide.
How do I adjust toxicity threshold?
Set the toxicity_threshold in your configuration:
yaml
guardrails:
toxicity_threshold: 0.7 # Adjust as neededUsage
How do I check input only?
Use GuardrailSystem directly:
python
guardrail = GuardrailSystem(config=config)
result = guardrail.check_input("user input")How do I get detailed results?
Use return_details=True:
python
result = rails.generate(
messages=messages,
return_details=True
)Can I use it asynchronously?
Yes, use generate_async():
python
result = await rails.generate_async(messages=messages)Troubleshooting
Why is my input being blocked?
Check the detailed results to see which check failed:
- Toxicity detection
- Sensitive data detection
- Content classification
How do I disable a specific check?
Set the check to false in configuration:
yaml
guardrails:
check_toxicity: falseWhy do I need an embedding encoder for content classification?
Content classification uses embeddings for semantic routing. The encoder type is configurable via the ENCODER_TYPE environment variable. Supported encoders include Azure OpenAI (default), OpenAI, Cohere, HuggingFace, FastEmbed, Ollama, Local, and more.
How do I persist guardrail runs to a database?
Enable ARMS Backend storage in your policy and set API_BASE_URL and ELSAI_ARMS_API_KEY. The Backend routes to MongoDB, DynamoDB, or ClickHouse automatically. See ARMS Storage.
yaml
guardrails:
storage:
enabled: true
project: my-app
arms_correlation: trueHow do I link guardrails storage to an ARMS run?
Call link_arms(arms) after creating both clients, or link_run_context(run_id=..., project_id=...). You can also set GUARDRAILS_ARMS_RUN_ID and GUARDRAILS_ARMS_PROJECT_ID environment variables.
How do I detect data leaks in LLM output?
Enable data_exfiltration in your guardrails policy. It runs on output only and can warn (mask) or block based on risk score. See Data Exfiltration Detection.
yaml
guardrails:
data_exfiltration:
enabled: true
action_thresholds:
warn: 20
block: 80Why is my output blocked for exfiltration?
Check result.exfiltration on the GuardrailResult. High-risk responses (credentials, bulk PII, export-style payloads) exceed the block threshold. Lower thresholds or disable specific detectors to tune behavior.
Integration
Can I use it with Flask/FastAPI?
Yes, see Integration Examples.
Can I use it with LangChain?
Yes, you can wrap LangChain chains with guardrails. See Integration Examples.