🚀 Liath: Your AI-Powered Database System
Liath is a next-generation database system that combines the power of key-value storage, vector search, and AI capabilities into one flexible platform. Built on RocksDB/LevelDB with Lua as its query language, it's designed for developers who want to build AI-powered applications quickly and efficiently.
✨ Key Features
Liath comes packed with powerful features to help you build AI-powered applications. Here's a quick overview:
- 🔌 Pluggable Storage: Choose between RocksDB and LevelDB
- 📝 Lua Query Language: Write powerful queries with familiar syntax
- 🧩 Plugin Architecture: Extend functionality with custom plugins
- 🔍 Vector Search: Built-in vector database capabilities
- 🤖 AI Integration: Direct access to language models
- 📊 Embedding Generation: Create and manage text embeddings
- 📁 File Operations: Built-in file storage and retrieval
- 🏷️ Namespaces: Isolate data and operations
- 💾 Transaction Support: ACID compliant (RocksDB)
- 🔐 User Authentication: Secure user management
- 🌐 CLI & HTTP API: Multiple ways to interact
- 💾 Backup & Restore: Keep your data safe
- ⚡ Query Caching: Optimize performance
- 📈 Monitoring: Track system performance
- 🔄 Connection Pooling: Handle high concurrency
📚 For detailed information about each feature, check out our Features Documentation
🛠️ Installation
As a Library
pip install liath
From Source
-
Prerequisites
- Python 3.11 or higher
- Poetry package manager
-
Install Poetry
pip install poetry
-
Clone & Setup
git clone https://github.com/nudgelang/liath.git cd liath poetry install
-
Create Directory Structure
mkdir -p data/default/{files,luarocks} plugins
-
Install Lua Dependencies
./liath/setup_luarocks.sh
📦 Usage
As a Library (Embedded Mode)
from liath import EmbeddedLiath
# Create an embedded database instance
db = EmbeddedLiath(data_dir="./my_data", storage_type="auto")
# Basic operations
db.put("key", "value")
retrieved_value = db.get("key")
print(retrieved_value) # Output: value
# Execute Lua queries
result = db.execute_lua('return db:get("key")')
print(result) # Output: value
# Switch namespaces
db.set_namespace("my_namespace")
db.put("namespaced_key", "namespaced_value")
# Close the database when done
db.close()
CLI Mode
liath-cli --storage auto
Server Mode
liath-server --storage auto --host 0.0.0.0 --port 5000
Basic Operations
-- Create user and login
create_user username password
login username password
-- Create and use namespace
create_namespace my_namespace
use my_namespace
-- Basic queries
query return db:put("key", "value")
query return db:get("key")
📦 Using LuaRocks Packages
Liath supports LuaRocks packages in your queries. Here's how:
-
Install a Package
luarocks install --tree=./data/namespaces/your_namespace package_name
-
Use in Queries
local json = db:require("cjson") return json.encode({key = "value"})
Example: HTTP Requests with LuaSocket
local http = db:require("socket.http")
local body, code = http.request("http://example.com")
return {body = body, status_code = code}
🔄 Storage Options
Choose your storage backend based on your needs:
| Feature | RocksDB | LevelDB |
|---|---|---|
| Performance | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ |
| Transactions | ✅ | ❌ |
| Column Families | ✅ | ❌ |
| Complexity | Medium | Low |
🔧 API Reference
EmbeddedLiath Class
The EmbeddedLiath class provides a Pythonic interface for interacting with the database.
Constructor
db = EmbeddedLiath(data_dir="./data", storage_type="auto")
Parameters:
data_dir(str): Directory to store database filesstorage_type(str): Storage backend ('auto', 'rocksdb', or 'leveldb')
Methods
put(key, value)
Store a key-value pair in the database.
get(key)
Retrieve a value from the database.
delete(key)
Delete a key-value pair from the database.
execute_lua(query)
Execute a Lua query.
set_namespace(namespace)
Switch to a different namespace.
create_user(username, password)
Create a new user.
authenticate_user(username, password)
Authenticate a user.
list_namespaces()
List all namespaces.
close()
Close the database connection.
Direct Database Access
For more advanced usage, you can access the underlying Database class directly:
from liath import Database
db = Database(data_dir="./data", storage_type="auto")
# ... use database methods directly
🧩 Extending Liath
Create custom plugins by:
- Adding a new Python file in
plugins/ - Inheriting from
PluginBase - Implementing required methods
Example Plugin
from liath.plugin_base import PluginBase
class MyPlugin(PluginBase):
@property
def name(self):
return "myplugin"
def initialize(self, context):
self.namespace = context['namespace']
def get_lua_interface(self):
return {
'my_function': self.lua_callable(self.my_function)
}
def my_function(self, arg1, arg2):
# Your plugin logic here
return f"Processed {arg1} and {arg2}"
📦 Using LuaRocks Packages
Liath supports LuaRocks packages in your queries. Here's how:
-
Install a Package
luarocks install --tree=./data/namespaces/your_namespace package_name
-
Use in Queries
local json = db:require("cjson") return json.encode({key = "value"})
Example: HTTP Requests with LuaSocket
local http = db:require("socket.http")
local body, code = http.request("http://example.com")
return {body = body, status_code = code}
🤝 Contributing
We welcome contributions! Feel free to:
- Submit pull requests
- Report bugs
- Suggest features
- Improve documentation
📄 License
MIT License - See LICENSE for details.
Metadata
Release files for liath 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| liath-0.1.0.tar.gz | 86.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| liath-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 189.6 kB
Release files / liath-0.1.0.tar.gz
| Download URL | liath-0.1.0.tar.gz |
|---|---|
| Size | 86.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09a282a3d40549e7949ef63e3c50c5c460d9aea431831f27c769a34f756bb2ec
|
|
BLAKE2b-256 checksum How to use checksums |
a28717282a5b3286cffcab5ed584ba3a22e6d23dc6498a27185578a51273abaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 22, 2025.
Transparency logRelease files / liath-0.1.0-py3-none-any.whl
| Download URL | liath-0.1.0-py3-none-any.whl |
|---|---|
| Size | 103.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8255a3ca7d4b725ef4fd4f2a9390f40200b799f9d48b8ec0c29fa223f760726c
|
|
BLAKE2b-256 checksum How to use checksums |
7fb63cf475de0b919a5b0984183353c7d7f1183e0ebbdb74e2640f3222dc82bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 22, 2025.
Transparency log