From fa82f328fed09653b669d565bff350b386299dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=BB=D0=B5=D0=B1=20=D0=9D=D0=B8=D0=BA=D0=B8=D1=88?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Fri, 5 Jun 2026 14:55:49 +0000 Subject: [PATCH] docs: README with Ollama setup instructions --- README.md | 68 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 9d815e8..54cc0cf 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,62 @@ -# RAG Agent with ChromaDB and Tavily +# RAG-агент с ChromaDB и веб-поиском -This repository contains a simple RAG agent that uses **ChromaDB** as a local vector store and **Tavily** for web search. The agent automatically selects the appropriate source (local knowledge base or the web) based on the query. +AI-агент с локальным RAG-хранилищем на **ChromaDB** и веб-поиском через **Tavily**. +Использует **Ollama** для LLM (`llama3`) и эмбеддингов (`nomic-embed-text`). -## Structure -- `vectorstore.py` – utilities for creating and loading the vector store. -- `tools.py` – LangChain tools for local and web search. -- `agent.py` – agent definition with routing logic. -- `main.py` – interactive CLI. -- `init_db.py` – helper script to load documents from `documents/` into the vector store. -- `requirements.txt` – dependencies. -- `documents/` – folder with sample `.txt`/`.md` files. +## Установка -## Usage ```bash -# Install dependencies +# Установить модели Ollama +ollama pull llama3 +ollama pull nomic-embed-text + +# Python-зависимости pip install -r requirements.txt +``` -# Load documents into the vector store +Создать `.env`: +``` +TAVILY_API_KEY=ваш_ключ_tavily +``` + +## Инициализация базы знаний + +Положи `.txt` / `.md` файлы в папку `documents/`, затем: + +```bash python init_db.py +``` -# Run the chat interface +## Запуск + +```bash python main.py ``` -## Environment -- `TAVILY_API_KEY` – required for web search. -- `OLLAMA_BASE_URL` – optional, defaults to `http://localhost:11434`. +## Архитектура + +| Файл | Назначение | +|------|------------| +| `vectorstore.py` | ChromaDB + `OllamaEmbeddings(model="nomic-embed-text")` | +| `tools.py` | `@tool search_local_kb` (ChromaDB) и `@tool web_search` (Tavily) | +| `main.py` | ReAct-агент на `ChatOllama(model="llama3")` + CLI чат-цикл | +| `init_db.py` | Загрузка документов из `documents/` с чанкингом | + +## Маршрутизация + +| Запрос | Инструмент | Источник в ответе | +|--------|-----------|-------------------| +| Вопросы по загруженным документам | `search_local_kb` | `chromadb` | +| Актуальные новости / факты | `web_search` | `tavily` | + +## Пример + +``` +Запрос: Какие последние новости про AI-агентов? +[Web Search] ... +Источник: tavily + +Запрос: Что в наших конспектах про LangGraph? +[Local KB] ... +Источник: chromadb +```