Answer legal questions with Groq using CanLII and CourtListener
Ready for 3.0What this workflow does
This AI workflow has 15 nodes and runs when someone submits an n8n form (“Legal research assistant”). Along the way it connects Groq Chat Model. It also calls courtlistener.com over HTTP.
How it runs
Trigger: When someone submits an n8n form (“Legal research assistant”).
- Set research configuration (Edit Fields (Set)): sets 6 fields: resultCount, canliiLanguage, citatorDirection…
- Route by source database (Switch): routes items into 2 branches
- Search CourtListener case law (HTTP Request): calls courtlistener.com (GET)
- Fetch CanLII case metadata (HTTP Request): calls an HTTP API (GET)
- Fetch CourtListener opinion text (HTTP Request): calls an HTTP API (GET)
- Build error result (Code): runs custom JavaScript code
- Fetch CanLII citator cases (HTTP Request): calls an HTTP API (GET)
- Build grounding context (Code): runs custom JavaScript code
- Return result (n8n Form): shows the next form page
- Answer grounded in retrieved sources (Basic LLM Chain): sends a prompt to an LLM, with model: Groq Chat Model; output parser: Structured citation parser
…plus 1 more step. See the full node list below.
Services it uses
HTTP calls to: courtlistener.com
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (9)
- n8n Form Trigger
n8n-nodes-base.formTrigger - Edit Fields (Set)
n8n-nodes-base.set - Switch
n8n-nodes-base.switch - HTTP Request
n8n-nodes-base.httpRequest - Code
n8n-nodes-base.code - Groq Chat Model
@n8n/n8n-nodes-langchain.lmChatGroq - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - n8n Form
n8n-nodes-base.form
From the author
Quick overview This workflow collects a legal question via an n8n form, retrieves supporting authorities from CourtListener or CanLII, and uses a Groq-hosted Llama model to produce an answer grounded only in the retrieved text with verified, non-hallucinated…