a8a8111eca213d3b90d529ac5c145e2cce48726e
CI / build (push) Has been cancelled
Agent with RAG Memory
This project demonstrates a simple LangChain agent that uses Retrieval-Augmented Generation (RAG) to answer questions based on a small set of documents. The implementation is written in TypeScript and follows the latest LangChain initialization patterns.
Features
- Updated Agent Initialization: Uses
initializeAgentExecutorWithOptionsfrom LangChain. - Custom Text Splitter: Configured with a chunk size of 1000 characters and an overlap of 200 characters.
- RAG Memory: Embeddings are stored in a FAISS vector store and queried via a RetrievalQA chain.
- Simple Test Harness: Runs a sample query and prints the agent's response.
Prerequisites
- Node.js v18 or newer
- npm
Setup
# Clone the repository
git clone https://github.com/your-username/agent-rag-memory.git
cd agent-rag-memory
# Install dependencies
npm install
# Create a .env file with your OpenAI API key
echo "OPENAI_API_KEY=your_api_key_here" > .env
Running the Agent
npm start
You should see output similar to:
=== Agent Response ===
Paris
Project Structure
agent-rag-memory/
├── src/
│ └── index.ts # Main implementation
├── package.json
├── tsconfig.json
└── README.md
License
MIT License
Description
Languages
Python
67.1%
TypeScript
16.6%
JavaScript
15.4%
Dockerfile
0.9%