π₯ The AIandMe Firewall
What is the AIandMe Firewall?
The AIandMe Firewall acts as a context-aware AI security filter, similar to a traditional cybersecurity firewall but tailored for GenAI applications. It analyzes user prompts in real-time and filters them based on business rules, security constraints, and ethical guidelines defined in your project settings.
β
Prevents AI misuse by filtering harmful, off-topic, or restricted inputs.
β
Deploys automatically when you create an AIandMe project.
β
Scalable & low-latency β Built on a serverless architecture for high performance.
Find your Firewall API details in:
Project Settings β Integration
Here, you'll get your custom API endpoint & key for integrating AIandMe with your GenAI assistant.
Using the Firewall API
The AIandMe Firewall is easy to integrate with any AI system. Just send a POST
request to your project-specific endpoint, and the firewall will evaluate the prompt in two stages:
1οΈβ£ Immediate Response β Returns a PASS/FAIL verdict and a log_id
for tracking.
2οΈβ£ Detailed Analysis β The full explanation is retrievable later using the log_id
.
Installation & Dependencies
Install the AIandMe Firewall SDK via pip
:
pip install aiandme
AIandMe Firewall Integration Example
Hereβs a Python integration example, showing how to use the AIandMe Firewall API in your application:
# Import necessary libraries
from aiandme import (
Firewall,
AIANDME_Firewall_CannotDecide,
AIANDME_Firewall_NotAuthorised,
)
from aiandme.schemas import Integration as IntegrationSchema
# Initialize the firewall with project credentials (endpoint & API key)
fw = Firewall(
IntegrationSchema(
endpoint="https://your-firewall-endpoint",
api_key="your-api-key",
)
)
# Analyze a user prompt
try:
user_prompt = "Request content for AI analysis..."
response = fw.eval(user_prompt)
if response.status:
# β
Safe prompt β Send to AI assistant
pass
elif response.fail_category == "off_topic":
print("π« Off-topic request")
elif response.fail_category == "violation":
print("π« Intent violation detected")
elif response.fail_category == "restriction":
print("π« Restricted action triggered")
except AIANDME_Firewall_CannotDecide:
print("π€ Firewall uncertainβmanual review needed.")
except AIANDME_Firewall_NotAuthorised:
print("β οΈ Authentication failed. Check your API credentials.")
except Exception as e:
print(f"β Unexpected error: {e}")
Two-Phase Firewall API Response
To optimize efficiency, the AIandMe Firewall API returns results in two phases:
1οΈβ£ Instant Response β Delivers a log ID and a quick PASS/FAIL assessment for real-time filtering.
2οΈβ£ Detailed Analysis β The full explanation of the AI evaluation can be retrieved later using the log ID.
Open-Source
The AIandMe Firewall is released as open-source π software to promote responsible AI usage and support AI security development, for more details & contributions β GitHub Repository (opens in a new tab)
π Next Steps
- βοΈ AIandMe Integration
- π Logging & Monitoring AI Responses
π‘ Need help? Check out FAQs or Join the AIandMe Community.