langchain-retrieval

majiayu000's avatarfrom majiayu000

Document Q&A with RAG using Supabase pgvector store.

⭐5stars🔀1forks📁View on GitHub🕐Updated Jan 11, 2026

When & Why to Use This Skill

This Claude skill enables advanced Document Q&A capabilities using Retrieval-Augmented Generation (RAG). By integrating LangChain.js with Supabase pgvector, it allows users to transform static documents into a dynamic, searchable knowledge base. It solves the problem of AI hallucinations by grounding Claude's responses in specific, uploaded datasets, ensuring high accuracy and context-awareness for complex information retrieval tasks.

Use Cases

  • Internal Corporate Wikis: Transform employee handbooks, SOPs, and internal documentation into an interactive assistant that provides instant answers to staff queries.
  • Customer Support Automation: Power self-service support portals by allowing customers to ask questions directly against product manuals and troubleshooting guides.
  • Legal and Compliance Analysis: Efficiently query large volumes of legal contracts or regulatory documents to find specific clauses or verify compliance requirements.
  • Academic and Technical Research: Enable researchers to upload collections of papers or technical specifications to quickly synthesize information and extract data points through semantic search.
namelangchain-retrieval
descriptionDocument Q&A with RAG using Supabase pgvector store.

LangChain Retrieval

Document Q&A with RAG (Retrieval Augmented Generation) using Supabase vector store.

Tech Stack

  • Framework: Next.js
  • AI: LangChain.js, AI SDK
  • Vector Store: Supabase pgvector
  • Package Manager: pnpm

Prerequisites

  • Supabase project with pgvector extension
  • OpenAI API key

Setup

1. Clone the Template

git clone --depth 1 https://github.com/Eng0AI/langchain-retrieval.git .

If the directory is not empty:

git clone --depth 1 https://github.com/Eng0AI/langchain-retrieval.git _temp_template
mv _temp_template/* _temp_template/.* . 2>/dev/null || true
rm -rf _temp_template

2. Remove Git History (Optional)

rm -rf .git
git init

3. Install Dependencies

pnpm install

4. Setup Environment Variables

Create .env with required variables:

  • SUPABASE_URL - Supabase project URL
  • SUPABASE_PRIVATE_KEY - Supabase service role key
  • OPENAI_API_KEY - For embeddings and LLM
  • SUPABASE_DB_URL - Direct PostgreSQL connection URL

5. Setup Vector Store

Initialize pgvector extension and create documents table in Supabase.

Build

pnpm build

Development

pnpm dev