import os
from avenieca.api.eca import ECA
from avenieca.api.model import Config, NextStateRequest
# Initialize client
config = Config(
uri="http://localhost:2580/v1",
username=os.getenv("USERNAME"),
password=os.getenv("PASSWORD")
)
eca = ECA(config)
# Create prediction request
nsr = NextStateRequest(
module_id="aggregate001",
recall=20,
range=20,
n=1,
status="e"
)
# Get predictions with mapped states
res, status = eca.cortex.predictions(data=nsr)
if status == 200:
print(f"Found {len(res.next_state)} possible next states")
for i, twins in enumerate(res.next_state):
print(f"\nPrediction {i + 1}:")
for twin in twins.list:
print(f" Module: {twin.module_id}")
print(f" State: {twin.state}")
# Get raw predictions
res_raw, status = eca.cortex.predictions_raw(data=nsr)
if status == 200:
print("\nRaw predictions:")
for twin in res_raw.current_state:
print(f"Current state vector: {twin.state}")