Validate AI answers with Google search, OpenAI GPT-4, Slack and Gmail alerts
Go to WorkflowDescription
Quick overview
This workflow receives an AI-generated Q&A via webhook, searches the web for supporting sources, and uses OpenAI to score and classify the answer as SAFE, SUSPICIOUS, or HALLUCINATED, then alerts via Slack or Gmail and returns a response to the webhook caller.
How it works
Receives a POST webhook request containing a question and answer.
Sends the question to a Google Search API endpoint and retrieves the top results.
Formats the top search snippets into a compact source list for validation.
Sends the question, answer, and sources to OpenAI (GPT-4 Turbo) to return a JSON verdict with a confidence score, reasoning, and classification.
Routes the result by classification, returning the result to the webhook caller for SAFE responses.
Sends a Slack message to a chosen channel when the response is classified as SUSPICIOUS.
Sends a critical Gmail alert email when the response is classified as HALLUCINATED.
Setup
Configure the incoming system to POST question and answer to the workflow’s webhook URL at /hallucination-check.
Add OpenAI credentials in n8n and ensure the selected model (GPT-4 Turbo) is available for your account.
Replace the placeholder Search API URL and X-API-KEY header in the HTTP request node with your Google/Serp API provider endpoint and key.
Add Slack credentials, select the target channel, and confirm the workflow can post messages.
Add Gmail credentials and replace your_email_here with the recipient address for critical alerts.
Additional info
Need Help?
If you need help improving this workflow, scaling it or adding advanced features like multi-model validation or AI monitoring dashboards, our n8n developers at WeblineIndia are happy to help and enhance it into a production-grade AI safety system.