|
1 | | -# sqlite-ai |
| 1 | +# SQLite-AI |
| 2 | + |
| 3 | +**SQLite-AI** is an extension for SQLite that brings artificial intelligence capabilities directly into the database. It enables developers to run, fine-tune, and serve AI models from within SQLite using simple SQL queries — ideal for on-device and edge applications where low-latency and offline inference are critical. The extension is actively developed by [SQLite AI](https://sqlite.ai), some API and features are still evolving. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +* **Embedded AI Inference**: Run transformer models directly from SQL queries. |
| 10 | +* **Streaming I/O**: Token-by-token streaming via SQL aggregate functions. |
| 11 | +* **Fine-tuning & Embedding**: On-device model customization and vector embedding. |
| 12 | +* **Full On-Device Support**: Works on iOS, Android, Linux, macOS, and Windows. |
| 13 | +* **Offline-First**: No server dependencies or internet connection required. |
| 14 | +* **Composable SQL Interface**: AI + relational logic in a single unified layer. |
| 15 | +* **Supports any GGUF model**: available on Huggingface; Qwen, Gemma, Llama, DeepSeek and more |
| 16 | + |
| 17 | +SQLite-AI supports **text embedding generation** for search and classification, a **chat-like interface with history and token streaming**, and **automatic context save and restore** across sessions — making it ideal for building conversational agents and memory-aware assistants. Support for **multimodal** (sound and image understanding) is coming soon, bringing even richer on-device intelligence. |
| 18 | + |
| 19 | +## Documentation |
| 20 | + |
| 21 | +For detailed information on all available functions, their parameters, and examples, refer to the [comprehensive API Reference](./API.md). |
| 22 | + |
| 23 | +## Installation |
| 24 | + |
| 25 | +### Pre-built Binaries |
| 26 | + |
| 27 | +Download the appropriate pre-built binary for your platform from the official [Releases](https://github.com/sqliteai/sqlite-ai/releases) page: |
| 28 | + |
| 29 | +- Linux: x86 and ARM |
| 30 | +- macOS: x86 and ARM |
| 31 | +- Windows: x86 |
| 32 | +- Android |
| 33 | +- iOS |
| 34 | + |
| 35 | +### Loading the Extension |
| 36 | + |
| 37 | +```sql |
| 38 | +-- In SQLite CLI |
| 39 | +.load ./ai |
| 40 | + |
| 41 | +-- In SQL |
| 42 | +SELECT load_extension('./ai'); |
| 43 | +``` |
| 44 | + |
| 45 | +## Getting Started |
| 46 | + |
| 47 | +Here's a quick example to get started with SQLite Sync: |
| 48 | + |
| 49 | +```bash |
| 50 | +# Start SQLite CLI |
| 51 | +sqlite3 myapp.db |
| 52 | +``` |
| 53 | + |
| 54 | +```sql |
| 55 | +-- Load the extension |
| 56 | +.load ./ai |
| 57 | + |
| 58 | +-- Load a model |
| 59 | +SELECT llm_model_load('models/llama-2-7b.gguf', 'context_size=4096,n_gpu_layers=99'); |
| 60 | + |
| 61 | +-- Run inference |
| 62 | +SELECT llm_text_generate('What is the most beautiful city in Italy?'); |
| 63 | +``` |
| 64 | + |
| 65 | +## 📦 Integrations |
| 66 | + |
| 67 | +Use SQLite-AI alongside: |
| 68 | + |
| 69 | +* **[SQLite-Vector](https://github.com/sqlite-ai/sqlite-vector)** – vector search from SQL |
| 70 | +* **[SQLite-Sync](https://github.com/sqlite-ai/sqlite-sync)** – sync on-device databases with the cloud |
| 71 | +* **[SQLite-JS](https://github.com/sqlite-ai/sqlite-js)** – define SQLite functions in JavaScript |
| 72 | + |
| 73 | +--- |
2 | 74 |
|
3 | 75 | ## License |
4 | 76 |
|
|
0 commit comments