Files
agent-s-rag-pamyatyu/README.md
T
2026-06-25 12:41:22 +03:00

57 lines
1.3 KiB
Markdown

# 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 `initializeAgentExecutorWithOptions` from 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
```bash
# 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
```bash
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