File size: 2,966 Bytes
40e5eae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# 🚀 RAG System Quick Start

This quick guide will help you launch the RAG system in 5 minutes!

## Prerequisites

✅ Python 3.9+  
✅ Ollama installed and running  
✅ llama3.2 model downloaded

## Step 1: Check Ollama

```bash
# Check that Ollama is installed
ollama --version

# Check available models
ollama list

# If llama3.2 is not in the list, download it
ollama pull llama3.2
```

## Step 2: Activate Virtual Environment

```bash
cd /Users/v.hirenko/Desktop/DevHubVault/my-ai-projects/rag-python-rag
source venv/bin/activate
```

## Step 3: Run the Application

```bash
python main.py
```

## What Will Happen?

1. ⬇️ Test document will be downloaded (Think Python PDF)
2. 📄 Document will be converted to markdown
3. ✂️ Text will be split into 847 chunks
4. 🔢 Embeddings will be generated for each chunk
5. 💾 Data will be saved to ChromaDB
6. 🌐 Web interface will open at http://localhost:7860

## Usage Example

After launching, open your browser and go to http://localhost:7860

**Try these questions:**

**In English:**

- "How do if-else statements work in Python?"
- "What are the different types of loops in Python?"
- "How do you handle errors in Python?"

**In other languages:**

- "Як працюють умовні оператори if-else в Python?" (Ukrainian)
- "Какие типы циклов есть в Python?" (Russian)
- "Як обробляти помилки в Python?" (Ukrainian)

## Execution Time

⏱️ **First run:** ~1-2 minutes  
⏱️ **Subsequent runs:** ~5-10 seconds  
⏱️ **Answer to question:** ~5-15 seconds

## Troubleshooting

### ❌ "Model llama3.2 not found"

```bash
ollama pull llama3.2
```

### ❌ "Connection refused to localhost:11434"

```bash
# Make sure Ollama is running
ollama serve
```

### ❌ "No module named 'fitz'"

```bash
source venv/bin/activate
pip install -r requirements.txt
```

## Next Steps

✅ Done? Great! Now try:

1. **Add your own documents:**

   - Place PDF/DOCX files in the `documents/` folder
   - Restart the application

2. **Configure parameters:**

   - Open `config.py`
   - Change model, chunk size, and other parameters

3. **Use programmatically:**

   ```python
   from vector_store import retrieve_context
   from llm_handler import generate_answer

   question = "Your question here"
   context, sources = retrieve_context(question)
   answer = generate_answer(question, context)
   print(answer)
   ```

## Useful Commands

```bash
# Check component status
python vector_store.py      # Vector DB statistics
python llm_handler.py        # LLM test
python document_converter.py # Document conversion

# Clear and reindex
python -c "
from vector_store import VectorStore
vs = VectorStore()
vs.clear_collection()
"

# Then restart main.py
python main.py
```

## Need Help?

📖 Full documentation: `README.md`  
🐛 Found a bug? Create an Issue  
💡 Have ideas? Pull Requests are welcome!

---

**Enjoy using the system! 🎉**