π Logging & Monitoring AI Responses
Why Monitor AI Responses?
AI security doesnβt stop at real-time filtering. Effective logging & monitoring ensures:
β
Full visibility into AI decisions β Track why prompts were accepted or blocked.
β
Auditability & Compliance β Maintain a record of all AI interactions for security reviews.
β
Continuous AI improvement β Use log data to fine-tune AI behavior & policies.
The AIandMe Firewall automatically logs every API request and response, enabling detailed post-analysis.
AIandMe Firewall Logs
Each firewall API call generates a unique log_id
, which you can use to retrieve detailed assessments later.
π Example: Firewall Log Dashboard
π Example: Detailed Log Analysis
Retrieving Logs via API
You can fetch logs programmatically using the AIandMe API.
πΉ Request Format
Send a GET
request with the log ID to retrieve the full AI analysis:
curl -X GET "https://your-firewall-endpoint/logs/{log_id}" \
-H "Authorization: Bearer your-api-key"
πΉ Python Example
Hereβs how to retrieve AIandMe Firewall logs using Python:
import requests
log_id = "your-log-id"
api_url = f"https://your-firewall-endpoint/logs/{log_id}"
headers = {"Authorization": "Bearer your-api-key"}
response = requests.get(api_url, headers=headers)
if response.status_code == 200:
log_data = response.json()
print("Log Details:", log_data)
else:
print("Failed to retrieve log:", response.status_code)
Log Data Breakdown
The API returns structured JSON data, containing:
- status β
pass
orfail
- fail_category β
off_topic
,violation
, orrestriction
- assessment_rationale β Explanation of why the prompt passed or failed
- timestamp β When the request was processed
π Example Response:
{
"log_id": "123456",
"status": "fail",
"fail_category": "restriction",
"assessment_rationale": "User attempted to request sensitive data.",
"timestamp": "2025-01-26T13:45:00Z"
}
Best Practices for AI Logging
- Regularly review logs β Identify patterns in AI failures.
- Use logs for model tuning β Improve accuracy based on failure cases.
- Enable alerts for critical failures β Automate responses to security violations.
π‘ Need help? Check out FAQs or Join the AIandMe Community.