Skip to content

Solirius/pins-ai-template-b

Repository files navigation

RAG-Based Knowledge Retrieval System (TypeScript/LangChain)

Local vector store RAG demo using TypeScript and LangChain.

  • ingest command to chunk and index source documents in knowledge base
  • chat command for interactive Q&A over retrieved context from knowledge base
  • Azure OpenAI for embeddings and chat
  • PostgreSQL + pgvector for retrieval
  • Chunking, retrieval, and context combination are delegated to LangChain primitives.

Requirements

  • Node.js 22+
  • Docker
  • Azure OpenAI deployment(s)
  • Managed identity (recommended) or API key auth

Configuration

All runtime settings live in config.yml:

  • Azure endpoint, API version, deployment names
  • Vector store connection and table names
  • Ingest chunking settings
  • Chat retrieval settings and system prompt

Environment variables

Only one environment variable is optionally used:

  • AZURE_OPENAI_API_KEY (only needed when not using managed identity)

Install

npm install

Start local vector store

docker compose up -d

Ingest documents

Provide one or more file paths to ingest:

npm run ingest -- ITM.pdf green-belts-v27.pdf style-guide-for-decisions.pdf

Chat with the knowledge base

npm run chat

Then ask questions in the prompt; type ctrl+d to exit.

About

RAG-Based Knowledge Retrieval System (TypeScript/LangChain)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors