Skip to main content

No project description provided

Project description

Neurion Ganglion - Ion Framework

Overview

Neurion Ganglion provides a framework for defining, deploying, and managing Ions – decentralized computational units that operate within the Neurion ecosystem. This repository offers a streamlined way to create and register Ions, either as self-hosted services or pre-existing services ready for registration.

Features

  • Define input and output schemas using Pydantic.
  • Register Ions with Neurion automatically or manually.
  • Health-check endpoints for ensuring service availability.
  • Auto-recovery mechanism for self-hosted Ions.
  • Easy-to-use decorators for defining execution logic.

Installation

pip install neurion-ganglion

Creating an Ion

You can create an Ion in two different ways:

1. Self-Hosting Ion (Auto-Registering)

This mode runs the Ion server locally and automatically registers it with Neurion.

from pydantic import BaseModel
from neurion_ganglion.ion.ion import Ion, ion_handler
from neurion_ganglion.types.capacity import Capacity

# Define Input Schema
class MyInputSchema(BaseModel):
    task_id: str
    parameters: int

# Define Output Schema
class MyOutputSchema(BaseModel):
    message: str
    result: float

# Use decorator to attach schemas
@ion_handler(MyInputSchema, MyOutputSchema)
def my_ion_handler(data: MyInputSchema) -> MyOutputSchema:
    """Handles execution logic."""
    return MyOutputSchema(message="Success", result=12)

# Start Ion Server
if __name__ == "__main__":
    description = "My custom Ion server"
    stake = 20000000
    fee_per_thousand_calls = 1
    capacities = [Capacity.SCRAPER, Capacity.AI_AGENT]
    Ion.create_self_hosting_ion(description, stake, fee_per_thousand_calls, capacities, my_ion_handler).start()

2. Registering an Existing Server (Server-Ready Ion)

If your Ion is already running and accessible, you can register it without hosting a new server.

from neurion_ganglion.ion.ion import Ion
from neurion_ganglion.types.capacity import Capacity
from pydantic import BaseModel

# Define Input Schema
class MyInputSchema(BaseModel):
    task_id: str
    parameters: int

# Define Output Schema
class MyOutputSchema(BaseModel):
    message: str
    result: float

# Register an existing Ion
if __name__ == "__main__":
    description = "My external Ion server"
    stake = 20000000
    fee_per_thousand_calls = 1
    capacities = [Capacity.SCRAPER, Capacity.AI_AGENT]
    endpoints = ["http://167.99.69.198:8000"]
    Ion.create_server_ready_ion(description, stake, fee_per_thousand_calls, capacities, MyInputSchema, MyOutputSchema, endpoints).register_ion()

Health Check

All Ions expose a /health endpoint that can be used to check their availability.

curl http://localhost:8000/health

License

This project is licensed under the MIT License.

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

neurion_ganglion-0.1.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

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

neurion_ganglion-0.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: neurion_ganglion-0.1.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.9.21 Linux/6.8.0-1021-azure

File hashes

Hashes for neurion_ganglion-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5dd088ba90b9b14a139f5c04d3302fb37b70bf441ab38ddca7bb62bfd2b5a8c8
MD5 1e7aef907010822754394f240304c96f
BLAKE2b-256 b32bf7de29b67acf9d8323049a5871bee1aeed643cc3f6ce1b527bd8a397144c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neurion_ganglion-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.9.21 Linux/6.8.0-1021-azure

File hashes

Hashes for neurion_ganglion-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d2edb9a64b5b629040eb0dd3d8bce152c08331001a659b5c7692b68f870e8c6
MD5 7a2f15984f451547b81d236082b6f834
BLAKE2b-256 ea2d78e9d980c82c1a6863ae1742900dfc882caf72e7f2e22be4cc7db05b889b

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