Обновить README.md

This commit is contained in:
2026-05-28 13:05:38 +00:00
parent f030702d33
commit c9b557514d
+35 -43
View File
@@ -1,66 +1,58 @@
# RAG-Agent — AI-агент с локальной базой знаний
# RAG Agent with Qdrant + Ollama
## Стек
- **Python 3.10+**
- **Qdrant**векторная база данных
- **Ollama**локальные LLM и эмбеддинги (`llama3`, `nomic-embed-text`)
- **LangChain / LangGraph** — агент с инструментами
## Stack
- Python 3.10+
- Qdrant — vector database
- Ollama — local LLM and embeddings (`llama3`, `nomic-embed-text`)
- LangChain — agent and RAG framework
## Быстрый старт
### 1. Установка зависимостей
```bash
pip install -r requirements.txt
```
### 2. Запуск Ollama и загрузка моделей
## Setup
### 1. Pull Ollama models
```bash
ollama pull llama3
ollama pull nomic-embed-text
```
### 3. Запуск Qdrant (Docker)
### 2. Start Qdrant
```bash
docker run -d -p 6333:6333 -p 6334:6334 \
-v qdrant_storage:/qdrant/storage \
qdrant/qdrant
docker run -p 6333:6333 qdrant/qdrant
```
### 4. Инициализация базы знаний из директории
### 3. Install Python dependencies
```bash
pip install -r requirements.txt
```
## Usage
### Initialize knowledge base from a directory
```bash
# Поместите .txt / .md файлы в папку docs/
python init_knowledge_base.py ./docs
```
Loads all `.txt` and `.md` files from the given directory into the vector store.
### 5. Запуск интерактивного клиента
### Run the interactive client
```bash
python client.py
```
## Команды в клиенте
### Client commands
| Command | Description |
|---------|-------------|
| `/add <title> \| <content>` | Add a document to the knowledge base |
| `/search <query>` | Semantic search in the knowledge base |
| `/quit` | Exit the client |
| `<any text>` | Send a question to the RAG agent |
| Команда | Описание |
|---------|----------|
| `/add <текст>` | Добавить текст в базу знаний |
| `/add-file <путь>` | Загрузить файл в базу знаний |
| `/search <запрос>` | Прямой семантический поиск (без агента) |
| `/quit` | Выйти |
| `<любой текст>` | Отправить запрос агенту |
## Архитектура
## Project Structure
```
client.py ← интерактивный CLI-клиент
├── agent.py ← create_react_agent (llama3 + RAG-инструменты)
│ └── tools.py ← @tool: search_knowledge_base, add_to_knowledge_base
── vector_store.py ← Qdrant + OllamaEmbeddings + RecursiveCharacterTextSplitter
init_knowledge_base.py ← загрузка документов из директории
.
├── vector_store.py # Qdrant + Ollama embeddings + chunking
├── tools.py # @tool: search_knowledge_base, add_to_knowledge_base
├── agent.py # create_react_agent with RAG tools
├── init_knowledge_base.py # Load documents from directory
── client.py # Interactive CLI client
└── requirements.txt
```