{"product_id":"n8n-webhook-rag-evaluator-ollama-postgresql-scores","title":"n8n Webhook RAG Evaluator: Ollama + PostgreSQL Scores","description":"\u003ch3\u003eEvaluate your RAG outputs with an n8n Webhook—Ollama scoring + PostgreSQL storage\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow exposes a \u003cstrong\u003ePOST webhook\u003c\/strong\u003e that automatically evaluates Retrieval-Augmented Generation (RAG) responses using a \u003cstrong\u003elocal Ollama model\u003c\/strong\u003e. It scores groundedness, retrieval relevance, answer relevance, hallucination, and citation quality—then saves the full evaluation in \u003cstrong\u003ePostgreSQL\u003c\/strong\u003e and returns the stored results as JSON.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReceives a webhook request\u003c\/strong\u003e containing a JSON payload (question, answer, retrieved context chunks, optional citations, and metadata).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eValidates the request\u003c\/strong\u003e for required fields, size limits, and \u003cem\u003eunique chunk IDs\u003c\/em\u003e; returns \u003cstrong\u003e400\u003c\/strong\u003e if validation fails.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCalls Ollama for evaluation\u003c\/strong\u003e by sending the question, answer, citations, and retrieved context to score:\n    \u003cul\u003e\n      \u003cli\u003eGroundedness\u003c\/li\u003e\n      \u003cli\u003eRetrieval relevance\u003c\/li\u003e\n      \u003cli\u003eAnswer relevance\u003c\/li\u003e\n      \u003cli\u003eHallucination detection\u003c\/li\u003e\n      \u003cli\u003eCitation quality\u003c\/li\u003e\n    \u003c\/ul\u003e\n  \u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRetries once with a stricter prompt\u003c\/strong\u003e if Ollama’s response doesn’t match the required JSON schema.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAggregates results\u003c\/strong\u003e into an overall score and grade, deduplicates unsupported claims, and generates issues and recommendations.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eStores evaluations in PostgreSQL\u003c\/strong\u003e (including evaluation_id, scores, issues, and recommendations) and returns the stored evaluation.\u003c\/li\u003e\n  \u003cli\u003eReturns \u003cstrong\u003e503\u003c\/strong\u003e if \u003cstrong\u003eOllama is unavailable\u003c\/strong\u003e or if the \u003cstrong\u003ePostgreSQL insert fails\u003c\/strong\u003e.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eQuality assurance for a SaaS RAG pipeline (before shipping an answer to users).\u003c\/li\u003e\n  \u003cli\u003eAutomated hallucination and citation quality checks for internal knowledge assistants.\u003c\/li\u003e\n  \u003cli\u003eBatch evaluation of generated responses during development and iteration of prompts\/retrievers.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWebhook\u003c\/strong\u003e endpoint for receiving evaluation inputs\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNodes used:\u003c\/strong\u003e \u003cem\u003eif\u003c\/em\u003e, \u003cem\u003ecode\u003c\/em\u003e, \u003cem\u003ewebhook\u003c\/em\u003e, \u003cem\u003epostgres\u003c\/em\u003e, \u003cem\u003ehttp request\u003c\/em\u003e, \u003cem\u003erespond to webhook\u003c\/em\u003e\n\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOllama integration:\u003c\/strong\u003e expects a running instance reachable at \u003cstrong\u003ehttp:\/\/ollama:11434\u003c\/strong\u003e using an evaluation model (SOURCE indicates “an evaluation model a”).\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46010438615219,"sku":"N8N-19523","price":53.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/xMaxIUmMqIw0N_0IGtBpp_EpugPTYc.png?v=1789290237","url":"https:\/\/buyflowscripts.com\/products\/n8n-webhook-rag-evaluator-ollama-postgresql-scores","provider":"N8N Commerce","version":"1.0","type":"link"}