We're working!
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user