feat: solution for 'Агент с RAG-памятью'
CI / build (push) Has been cancelled

This commit is contained in:
2026-06-30 14:54:48 +03:00
parent 65558fb22a
commit 442d4d7578
3 changed files with 36 additions and 67 deletions
+12 -50
View File
@@ -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.
---
Ensure that Qdrant and Ollama services are running locally or update the URLs accordingly.