Internal ASGI API engine for Xalorra
Project description
๐ง Xalorra API Engine (Internal API)
Xalorra API Engine adalah core backend internal berbasis ASGI (tanpa framework eksternal seperti FastAPI) yang melayani prediksi model ML dan log streaming melalui WebSocket. Proyek ini dibangun sebagai fondasi internal yang ringan, modular, dan fleksibel untuk kebutuhan real-time ML orchestration.
๐ Fitur Utama
- โ API prediksi model ML (via HTTP POST)
- โ WebSocket log streaming real-time
- โ
CLI command:
xalorra runserver,xalorra logs, dll - โ Modular routing, middleware, dan request parsing
- โ Tanpa ketergantungan framework (murni ASGI)
- ๐ก Support WebSocket handler untuk observasi prediksi
- ๐ Logging ke file
logs/predictions.log
๐ Struktur Proyek
API\_engine/
โโโ xalorra/
โ โโโ cli.py # CLI utama (xalorra runserver/logs/...)
โ โโโ server.py # ASGI app (entrypoint uvicorn)
โ โโโ routing.py # Routing custom
โ โโโ request.py # Request wrapper
โ โโโ response.py # Response wrapper
โ โโโ middleware.py # Middleware support
โ โโโ websocket.py # WebSocket log stream handler
โโโ logs/
โ โโโ predictions.log # File log prediksi
โโโ test\_ws.py # Script client WebSocket
โโโ setup.py
โโโ pyproject.toml
โโโ README.md
๐ ๏ธ Instalasi
- Clone repo ini ke dalam server atau folder kerja kamu:
git clone <repo-url> /opt/API_engine cd /opt/API_engine
2. Install environment:
```bash
python3 -m venv venv
source venv/bin/activate
pip install -e .
```
---
## โ๏ธ CLI Xalorra
Setelah diinstall, kamu bisa menjalankan CLI dengan:
```bash
xalorra runserver # Menjalankan API di port 8001
xalorra logs --tail # Melihat log prediksi realtime
```
Jika belum bisa diakses, tambahkan `~/.local/bin` ke `$PATH`.
---
## ๐ API Prediksi
Endpoint HTTP untuk melakukan prediksi:
```http
POST /predict/<model_name>
```
### Contoh:
```bash
curl -X POST http://localhost:8001/predict/xgb-v2 \
-H "Content-Type: application/json" \
-d '{"features": [9, 1]}'
```
Respon:
```json
{
"model": "xgb-v2",
"input": [9, 1],
"prediction": 10
}
```
---
## ๐ WebSocket Streaming
Koneksi WebSocket ke endpoint:
```
ws://localhost:8001/ws/predict-stream
```
### Contoh Script (test\_ws.py)
```python
import asyncio
import websockets
async def run():
uri = "ws://localhost:8001/ws/predict-stream"
async with websockets.connect(uri) as ws:
print("โ
Connected to WebSocket")
while True:
msg = await ws.recv()
print("[RECV]", msg)
asyncio.run(run())
```
---
## ๐งช Status Saat Ini
* โ
API internal modular berjalan
* โ
Bisa diakses tanpa FastAPI
* โ
CLI dan WebSocket berfungsi baik
* โณ Belum terintegrasi database (sementara pakai `predictions.log`)
* ๐ Akan dikembangkan: `@task`, `@flow`, AutoML orchestrator, dashboard
---
## ๐ License
Hak cipta kode API Engine ini dimiliki oleh **Xalorra Foundation**.
Lisensi khusus digunakan untuk internal proyek Xalorra dan afiliasinya.
Lisensi: **Proprietary โ Internal Use Only**
---
## ๐จโ๐ป Kontribusi
Proyek ini belum dibuka untuk kontribusi publik. Namun kamu bisa fork, pelajari, atau adaptasi untuk riset internal. Silakan hubungi:
๐ฌ **[contact@xalorra.com](mailto:contact@xalorra.com)**
---
## ๐ง Tentang Xalorra
Xalorra adalah platform AI terbuka untuk membangun alur kerja ML dan Generative AI dengan pendekatan komunitas dan open-source.
> **"Empowering Open AI Workflows for Everyone."**
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 xalorra_api_engine-0.1.1.tar.gz.
File metadata
- Download URL: xalorra_api_engine-0.1.1.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eee5ae3a63516b3058a4082896bb0f4d797ce5ca87728fc42226a15aa2f49d60
|
|
| MD5 |
0939bb766271d33bc8bcca1509b7513a
|
|
| BLAKE2b-256 |
61db5f839d93ddc1214be704dd5deb14e7de1d1ce58b160f86fb6148b86fc6f7
|
File details
Details for the file xalorra_api_engine-0.1.1-py3-none-any.whl.
File metadata
- Download URL: xalorra_api_engine-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e2b80a2890c92e1f31e5d9977a260964bff11625766603db95da1994a282fa9
|
|
| MD5 |
ab3e269685a93c115fd8b9d68584d6ed
|
|
| BLAKE2b-256 |
a7b8f07314091dc133fcc672a2e29396beeb624ce4c65fb06bfd2b47a24cb64d
|