Обновить README.md
This commit is contained in:
@@ -1,66 +1,58 @@
|
|||||||
# RAG-Agent — AI-агент с локальной базой знаний
|
# RAG Agent with Qdrant + Ollama
|
||||||
|
|
||||||
## Стек
|
## Stack
|
||||||
- **Python 3.10+**
|
- Python 3.10+
|
||||||
- **Qdrant** — векторная база данных
|
- Qdrant — vector database
|
||||||
- **Ollama** — локальные LLM и эмбеддинги (`llama3`, `nomic-embed-text`)
|
- Ollama — local LLM and embeddings (`llama3`, `nomic-embed-text`)
|
||||||
- **LangChain / LangGraph** — агент с инструментами
|
- LangChain — agent and RAG framework
|
||||||
|
|
||||||
## Быстрый старт
|
## Setup
|
||||||
|
|
||||||
### 1. Установка зависимостей
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install -r requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Запуск Ollama и загрузка моделей
|
|
||||||
|
|
||||||
|
### 1. Pull Ollama models
|
||||||
```bash
|
```bash
|
||||||
ollama pull llama3
|
ollama pull llama3
|
||||||
ollama pull nomic-embed-text
|
ollama pull nomic-embed-text
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Запуск Qdrant (Docker)
|
### 2. Start Qdrant
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -d -p 6333:6333 -p 6334:6334 \
|
docker run -p 6333:6333 qdrant/qdrant
|
||||||
-v qdrant_storage:/qdrant/storage \
|
|
||||||
qdrant/qdrant
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. Инициализация базы знаний из директории
|
### 3. Install Python dependencies
|
||||||
|
```bash
|
||||||
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Initialize knowledge base from a directory
|
||||||
```bash
|
```bash
|
||||||
# Поместите .txt / .md файлы в папку docs/
|
|
||||||
python init_knowledge_base.py ./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
|
```bash
|
||||||
python client.py
|
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 |
|
||||||
|
|
||||||
| Команда | Описание |
|
## Project Structure
|
||||||
|---------|----------|
|
|
||||||
| `/add <текст>` | Добавить текст в базу знаний |
|
|
||||||
| `/add-file <путь>` | Загрузить файл в базу знаний |
|
|
||||||
| `/search <запрос>` | Прямой семантический поиск (без агента) |
|
|
||||||
| `/quit` | Выйти |
|
|
||||||
| `<любой текст>` | Отправить запрос агенту |
|
|
||||||
|
|
||||||
## Архитектура
|
|
||||||
|
|
||||||
```
|
```
|
||||||
client.py ← интерактивный CLI-клиент
|
.
|
||||||
│
|
├── vector_store.py # Qdrant + Ollama embeddings + chunking
|
||||||
├── agent.py ← create_react_agent (llama3 + RAG-инструменты)
|
├── tools.py # @tool: search_knowledge_base, add_to_knowledge_base
|
||||||
│ └── 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
|
||||||
└── vector_store.py ← Qdrant + OllamaEmbeddings + RecursiveCharacterTextSplitter
|
├── client.py # Interactive CLI client
|
||||||
|
└── requirements.txt
|
||||||
init_knowledge_base.py ← загрузка документов из директории
|
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user