docs: README with Ollama setup instructions
This commit is contained in:
@@ -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
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user