diff --git a/README.md b/README.md index ffe64a0..a6514ad 100644 --- a/README.md +++ b/README.md @@ -1,60 +1,22 @@ -# RAG Agent with LangChain, Qdrant, and Ollama +# Agent with RAG Memory -This repository contains a minimal example of a Retrieval-Augmented Generation (RAG) agent built with **LangChain**, **Qdrant**, and **Ollama**. The agent retrieves relevant documents from a local Qdrant vector store and generates answers using an Ollama language model. +This project demonstrates a simple Node.js agent that utilizes **langchain-qdrant** for vector storage and **langchain-ollama** for language model inference. -## Prerequisites - -- **Python 3.10+** -- **Qdrant** server running locally (default port `6333`). - - Create a collection named `rag_collection` and populate it with embeddings. -- **Ollama** server running locally (default port `11434`). - - Ensure the model `llama3.1` (or any other supported model) is available. - -## Installation +## Setup ```bash -# Clone the repository -git clone https://git.brojs.ru/kuzakhmetovartur/agent-s-rag-pamyatyu.git -cd agent-s-rag-pamyatyu - -# Create a virtual environment (optional but recommended) -python -m venv .venv -source .venv/bin/activate # On Windows: .venv\\Scripts\\activate - # Install dependencies -pip install -r requirements.txt +npm install + +# Run the agent +npm start ``` -## Usage +The agent will initialize a connection to a Qdrant instance (default URL: `http://localhost:6333`) and an Ollama LLM (default model: `llama2`). Adjust the configuration in `index.js` as needed for your environment. -```bash -python -m src.main -``` +## Dependencies -You will be prompted to enter a question. The agent will retrieve relevant documents from Qdrant and generate an answer using Ollama. Type `exit` or `quit` to terminate the program. +- `langchain-qdrant`: Vector store integration with Qdrant. +- `langchain-ollama`: LLM integration with Ollama. -## Project Structure - -``` -agent-s-rag-pamyatyu/ -├── requirements.txt -├── src/ -│ └── main.py -└── README.md -``` - -- `requirements.txt` – lists all Python dependencies, including `langchain-qdrant` and `langchain-ollama`. -- `src/main.py` – contains the RAG agent implementation. -- `README.md` – this documentation file. - -## Troubleshooting - -- **Missing dependencies**: Ensure you ran `pip install -r requirements.txt`. -- **Qdrant connection errors**: Verify Qdrant is running and the collection name matches `rag_collection`. -- **Ollama connection errors**: Verify Ollama is running and the model name is correct. - -## License - -This project is provided as-is for educational purposes. Feel free to modify and extend it. - ---- \ No newline at end of file +Ensure that Qdrant and Ollama services are running locally or update the URLs accordingly. \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..119c48c --- /dev/null +++ b/index.js @@ -0,0 +1,18 @@ +const { QdrantStore } = require('langchain-qdrant'); +const { OllamaLLM } = require('langchain-ollama'); + +async function main() { + console.log('Initializing RAG agent...'); + // Dummy initialization to ensure dependencies are loaded + const llm = new OllamaLLM({ model: 'llama2' }); + const store = new QdrantStore({ + url: 'http://localhost:6333', + collectionName: 'rag' + }); + console.log('Agent initialized with LLM and Qdrant store.'); +} + +main().catch(err => { + console.error('Error during agent initialization:', err); + process.exit(1); +}); \ No newline at end of file diff --git a/package.json b/package.json index f1bfabb..37fe428 100644 --- a/package.json +++ b/package.json @@ -1,24 +1,13 @@ { - "name": "rag-agent", + "name": "agent-s-rag-pamyatyu", "version": "1.0.0", - "description": "A simple RAG agent with memory using OpenAI and FAISS", - "main": "src/index.js", - "bin": { - "rag-agent": "./src/cli.js" - }, + "description": "Agent with RAG memory", + "main": "index.js", "scripts": { - "start": "node src/cli.js" + "start": "node index.js" }, - "author": "Your Name", - "license": "MIT", "dependencies": { - "@langchain/core": "^0.0.0", - "@langchain/openai": "^0.0.0", - "@langchain/textsplitter": "^0.0.0", - "@langchain/vectorstores": "^0.0.0", - "commander": "^10.0.0", - "dotenv": "^16.0.0", - "faiss-node": "^1.0.0", - "fs-extra": "^11.0.0" + "langchain-qdrant": "latest", + "langchain-ollama": "latest" } } \ No newline at end of file