CoolFace
Apppublic

dhruv-punia-bits/memory-compaction-openenv

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
client.py29 linesDownload Raw Back to root
1"""Minimal compatibility client placeholder for OpenEnv tooling."""2 3from __future__ import annotations4 5import os6from typing import Any7 8import requests9 10 11class MemoryCompactionClient:12    def __init__(self, base_url: str | None = None) -> None:13        self.base_url = (base_url or os.getenv("ENV_BASE_URL") or "http://127.0.0.1:7860").rstrip("/")14 15    def reset(self, payload: dict[str, Any]) -> dict[str, Any]:16        response = requests.post(f"{self.base_url}/reset", json=payload, timeout=60)17        response.raise_for_status()18        return response.json()19 20    def step(self, payload: dict[str, Any]) -> dict[str, Any]:21        response = requests.post(f"{self.base_url}/step", json=payload, timeout=60)22        response.raise_for_status()23        return response.json()24 25    def state(self) -> dict[str, Any]:26        response = requests.get(f"{self.base_url}/state", timeout=60)27        response.raise_for_status()28        return response.json()29