-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathllms.txt
More file actions
236 lines (175 loc) · 6.18 KB
/
llms.txt
File metadata and controls
236 lines (175 loc) · 6.18 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# Notolog Editor - LLM Context File
> An open-source Markdown editor built with Python and PySide6, featuring AI-powered assistance with multiple LLM backends.
## Project Overview
**Name:** Notolog
**Version:** 1.2.0
**License:** MIT
**Language:** Python 3.10+
**Author:** Vadim Bakhrenkov
**Repository:** https://github.com/notolog/notolog-editor
**Website:** https://notolog.app
**PyPI:** https://pypi.org/project/notolog
## Key Features
- **Markdown Editor** with syntax highlighting and real-time preview
- **AI Assistant** with multiple backends:
- OpenAI API (cloud-based)
- On-Device LLM (ONNX format)
- Module llama.cpp (GGUF format)
- **File Encryption** using AES-128 with PBKDF2 (768,000 iterations)
- **Multi-language Support** (19 languages)
- **Customizable Themes** (6 built-in themes)
- **Cross-platform** (Linux, macOS, Windows)
## Architecture
### Core Components
- `notolog/app.py` - Main application entry point
- `notolog/notolog_editor.py` - Main editor window (QMainWindow)
- `notolog/edit_widget.py` - Markdown editing widget
- `notolog/view_widget.py` - HTML preview widget
- `notolog/settings.py` - Application settings management
### AI Modules (modular architecture)
- `notolog/modules/base_ai_core.py` - Base class for AI modules
- `notolog/modules/openai_api/` - OpenAI API integration
- `notolog/modules/ondevice_llm/` - ONNX Runtime GenAI integration
- `notolog/modules/llama_cpp/` - llama.cpp Python bindings integration
### UI Components
- `notolog/ui/toolbar.py` - Main toolbar
- `notolog/ui/search_form.py` - In-document search
- `notolog/ui/ai_assistant/` - AI Assistant dialog
- `notolog/ui/settings_dialog.py` - Settings configuration
## Documentation
- [Getting Started](docs/getting-started.md) - Installation and first steps
- [User Guide](docs/user-guide.md) - Complete feature overview
- [AI Assistant Guide](docs/ai-assistant.md) - AI features setup
- [AI Modules](docs/ai-modules.md) - AI modules documentation
- [Configuration](docs/configuration.md) - Settings reference
- [API Reference](docs/api-reference.md) - Developer documentation
- [FAQ & Troubleshooting](docs/faq.md) - Common issues
- [Markdown Syntax Examples](docs/markdown-syntax.md) - Markdown syntax examples
## Installation
```bash
# Using pip (recommended)
pip install notolog
# With llama.cpp support
pip install "notolog[llama]"
# Using conda
conda install notolog -c conda-forge
# From source
git clone https://github.com/notolog/notolog-editor.git
cd notolog-editor
pip install .
```
## Development Setup
```bash
# Clone repository
git clone https://github.com/notolog/notolog-editor.git
cd notolog-editor
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # Linux/macOS
# venv\Scripts\activate # Windows
# Install in development mode
pip install -e .
# Install development dependencies
python dev_install.py dev
# Install test dependencies
python dev_install.py test
# Run tests
pytest tests/ --cov=notolog --cov-report=term
```
## AI Modules
### On Device LLM (ONNX Runtime GenAI)
- Supports hardware acceleration via ExecutionProvider enum
- Providers: CPU (default), CUDA, DirectML, OpenVINO, CoreML, TensorRT RTX, QNN, MIGraphX
- CUDA/DirectML packages replace base package (cannot coexist)
- Model helper with automatic fallback to CPU on provider errors
- Auto-reduces max_length on memory allocation failures
### Module llama.cpp
- Uses llama-cpp-python for GGUF model inference
- Automatic optimal thread count detection
- Batch processing: n_batch=512, n_ubatch=512
- **macOS**: Apple Silicon (M1-M4) uses Metal GPU acceleration automatically
### OpenAI API
- Cloud-based inference via OpenAI-compatible endpoints
- Supports custom API URLs for compatible services
## Quick Configs (Copy-Paste Ready)
### GPU Setup (NVIDIA CUDA)
```bash
pip uninstall onnxruntime-genai -y
pip install onnxruntime-genai-cuda
```
### GPU Setup (Windows DirectML)
```bash
pip uninstall onnxruntime-genai -y
pip install onnxruntime-genai-directml
```
### Revert to CPU
```bash
pip uninstall onnxruntime-genai-cuda onnxruntime-genai-directml -y
pip install --force-reinstall onnxruntime-genai
```
### Recommended ONNX Model
```
Model: microsoft/Phi-3-mini-4k-instruct-onnx
Path: cpu_and_mobile/cpu-int4-rtn-block-32/
```
### Recommended GGUF Model
```
Model: Qwen/Qwen2-7B-Instruct-GGUF
File: qwen2-7b-instruct-q5_k_m.gguf
Size: ~6GB RAM required
```
## AI Module Development
To create a custom AI module:
```python
from notolog.modules.base_ai_core import BaseAiCore
class ModuleCore(BaseAiCore):
module_name = 'My AI Module'
extensions = ['ai_assistant', 'settings_dialog']
def get_prompt_manager(self):
return self.prompt_manager
async def request(self, user_prompt, request_msg_id, response_msg_id,
init_callback=None, finished_callback=None):
# Implement inference logic
pass
```
## Dependencies
### Core
- PySide6 (>=6.8.0) - Qt6 bindings
- cryptography (>=43.0.1) - File encryption
- Markdown (^3.7) - Markdown processing
- qasync (>=0.27.1) - Async Qt integration
- Pygments (^2.18.0) - Code syntax highlighting
### Optional
- llama-cpp-python (^0.3.8) - GGUF model support
- onnxruntime-genai (>=0.11.0,<1.0.0) - ONNX model support (CPU)
- onnxruntime-genai-cuda - ONNX with CUDA support (replaces base package)
- onnxruntime-genai-directml - ONNX with DirectML support (replaces base package)
- openai - OpenAI API client
## Testing
```bash
# Run all tests
pytest tests/
# Run with coverage
pytest tests/ --cov=notolog --cov-report=html
# Run specific module tests
pytest tests/modules_tests/
# Skip UI tests (for headless environments)
pytest tests/ --ignore=tests/ui_tests/
```
## Code Style
- **Style Guide:** PEP 8
- **Max Line Length:** 127 characters
- **Max Complexity:** 15
- **Linting:** flake8
```bash
# Run linting
flake8 . --count --exit-zero --max-complexity=15 --max-line-length=127 --per-file-ignores="__init__.py:F401" --statistics
```
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
## Security
See [SECURITY.md](SECURITY.md) for vulnerability reporting.
## License
MIT License - Copyright (c) 2024-2026 Vadim Bakhrenkov
---
*This file provides context for Large Language Models working with the Notolog codebase.*