We're working!

This commit is contained in:
James Eversole
2025-05-28 12:34:43 -05:00
parent c157641063
commit 720ed05912
3 changed files with 28 additions and 12 deletions

View File

@ -1,13 +1,30 @@
import resource
import subprocess
import time
import llm
TRICU_PATH = "/usr/local/bin/tricu"
def tricu-bridge(input: str) -> str:
"""
Description of tool goes here.
"""
return f"hello {input}"
def tricubridge(input: str) -> str:
try:
result = subprocess.run(
[TRICU_PATH, "eval", "+RTS", "-M250M", "-RTS"],
input=input,
capture_output=True,
text=True,
check=True,
)
if len(result.stdout) > 2000:
return "Output too large; limited to 2000 chars."
else:
return result.stdout.strip()
except subprocess.CalledProcessError as e:
return f"Error executing Tricu code: {e.stderr or str(e)}"
except Exception as e:
return f"Unexpected error: {str(e)}"
@llm.hookimpl
def register_tools(register):
register(tricu-bridge)
register(tricubridge)