An AI-powered database system with key-value storage, vector search, and AI capabilities
Project description
🚀 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file liath-0.1.0.tar.gz.
File metadata
- Download URL: liath-0.1.0.tar.gz
- Upload date:
- Size: 86.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09a282a3d40549e7949ef63e3c50c5c460d9aea431831f27c769a34f756bb2ec
|
|
| MD5 |
f4b1898f7ee143306cda19e4273dc61b
|
|
| BLAKE2b-256 |
a28717282a5b3286cffcab5ed584ba3a22e6d23dc6498a27185578a51273abaf
|
Provenance
The following attestation bundles were made for liath-0.1.0.tar.gz:
Publisher:
publish.yml on Skelf-Research/liath
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
liath-0.1.0.tar.gz -
Subject digest:
09a282a3d40549e7949ef63e3c50c5c460d9aea431831f27c769a34f756bb2ec - Sigstore transparency entry: 422105036
- Sigstore integration time:
-
Permalink:
Skelf-Research/liath@41ee9ca3f2bcdc0a541240b19e4088dfc74cad06 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/Skelf-Research
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@41ee9ca3f2bcdc0a541240b19e4088dfc74cad06 -
Trigger Event:
release
-
Statement type:
File details
Details for the file liath-0.1.0-py3-none-any.whl.
File metadata
- Download URL: liath-0.1.0-py3-none-any.whl
- Upload date:
- Size: 103.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8255a3ca7d4b725ef4fd4f2a9390f40200b799f9d48b8ec0c29fa223f760726c
|
|
| MD5 |
8aa2561ece42be84833631fa4e90ca70
|
|
| BLAKE2b-256 |
7fb63cf475de0b919a5b0984183353c7d7f1183e0ebbdb74e2640f3222dc82bd
|
Provenance
The following attestation bundles were made for liath-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Skelf-Research/liath
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
liath-0.1.0-py3-none-any.whl -
Subject digest:
8255a3ca7d4b725ef4fd4f2a9390f40200b799f9d48b8ec0c29fa223f760726c - Sigstore transparency entry: 422105071
- Sigstore integration time:
-
Permalink:
Skelf-Research/liath@41ee9ca3f2bcdc0a541240b19e4088dfc74cad06 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/Skelf-Research
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@41ee9ca3f2bcdc0a541240b19e4088dfc74cad06 -
Trigger Event:
release
-
Statement type: