Skip to main content

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

  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xalorra_api_engine-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xalorra_api_engine-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file xalorra_api_engine-0.1.0.tar.gz.

File metadata

  • Download URL: xalorra_api_engine-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for xalorra_api_engine-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0e038e2aa29bf033a4146ddf5265df29979fd3562f620c6dd71644639d9d6c1f
MD5 26953cc7cb9d07ff2dc80f06486f0e20
BLAKE2b-256 5f86419edf5f21e7306f17fc7e5011c35eff1a5211120ba50cefa7da6687b5bb

See more details on using hashes here.

File details

Details for the file xalorra_api_engine-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for xalorra_api_engine-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ddf899a1261c3b831d8fe8144609a73ae94aa4e5206ae1ce102524c0e7d6b7d
MD5 ea86afa75fe64de832b0f9cfe2afd4a2
BLAKE2b-256 82f9392af876f5d75b84053f9086c70044ba8512e469781ec420aafb4ac9b8e8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page