langchain-retrieval-agent

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

LangChain Retrieval Agent

LangChain 检索Agent

An AI agent with retrieval tool for document Q&A using RAG, powered by LangGraph.
一款基于LangGraph、采用RAG技术的AI Agent,具备检索工具,可用于文档问答。

Tech Stack

技术栈

  • Framework: Next.js
  • AI: LangChain.js, LangGraph, AI SDK
  • Vector Store: Supabase pgvector
  • Package Manager: pnpm
  • 框架:Next.js
  • AI组件:LangChain.js、LangGraph、AI SDK
  • 向量数据库:Supabase pgvector
  • 包管理器:pnpm

Prerequisites

前置条件

  • Supabase project with pgvector extension
  • OpenAI API key
  • 已启用pgvector扩展的Supabase项目
  • OpenAI API密钥

Setup

设置步骤

1. Clone the Template

1. 克隆模板

bash
git clone --depth 1 https://github.com/Eng0AI/langchain-retrieval-agent.git .
If the directory is not empty:
bash
git clone --depth 1 https://github.com/Eng0AI/langchain-retrieval-agent.git _temp_template
mv _temp_template/* _temp_template/.* . 2>/dev/null || true
rm -rf _temp_template
bash
git clone --depth 1 https://github.com/Eng0AI/langchain-retrieval-agent.git .
如果目录非空:
bash
git clone --depth 1 https://github.com/Eng0AI/langchain-retrieval-agent.git _temp_template
mv _temp_template/* _temp_template/.* . 2>/dev/null || true
rm -rf _temp_template

2. Remove Git History (Optional)

2. 移除Git历史记录(可选)

bash
rm -rf .git
git init
bash
rm -rf .git
git init

3. Install Dependencies

3. 安装依赖

bash
pnpm install
bash
pnpm install

4. Setup Environment Variables

4. 配置环境变量

  • SUPABASE_URL
    - Supabase project URL
  • SUPABASE_PRIVATE_KEY
    - Supabase service role key
  • OPENAI_API_KEY
    - For embeddings and LLM
  • SUPABASE_URL
    - Supabase项目URL
  • SUPABASE_PRIVATE_KEY
    - Supabase服务角色密钥
  • OPENAI_API_KEY
    - 用于嵌入模型和大语言模型

Build

构建

bash
pnpm build
bash
pnpm build

Development

开发

bash
pnpm dev
bash
pnpm dev