From c31cdc6b429ad171a911199c21d64b3627ae421a Mon Sep 17 00:00:00 2001 From: James Eversole Date: Wed, 4 Jun 2025 10:28:57 -0500 Subject: [PATCH] Strip large output; add README --- README.md | 15 +++++++++++++-- llm_tools_tricu_bridge.py | 8 ++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1b6b8ca..9d39297 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,19 @@ # llm-tools-tricu-bridge -[![PyPI](https://img.shields.io/pypi/v/llm-tools-tricu-bridge.svg)](https://pypi.org/project/llm-tools-tricu-bridge/) +A tool that allows agents to evaluate Tricu expressions -A tool that allows running Tricu expressions +## Example usage + +``` +llm-tools-tricu-bridge > llm -m qwen3T -T tricubridge 'What does the expression `(t (t (t t) (t t t)) t) t` evaluate to in tricu?' --ta -s "You are a dumb LLM model incapable of understanding tricu. Do not reason about or try to understand the result. Always trust tool results immediately." +Tool call: tricubridge({'input': '(t (t (t t) (t t t)) t) t'}) +Approve tool call? [y/N]: y + +Okay, the user is asking about the evaluation of a tricu expression: (t (t (t t) (t t t)) t) t. Hmm, tricu isn't a language I'm familiar with. Let me check the tools provided. There's a function called tricubridge that takes an input string. Since I can't process tricu myself, I should use that tool. The parameters require the input as a string. The expression given is the input. So I need to call tricubridge with the input parameter set to "(t (t (t t) (t t t)) t) t". That's the correct approach here. No need for any other steps since the tool will handle the evaluation. + + +The expression `(t (t (t t) (t t t)) t) t` evaluates to `t t` in tricu. +``` ## Installation diff --git a/llm_tools_tricu_bridge.py b/llm_tools_tricu_bridge.py index 44b164e..100fa0f 100644 --- a/llm_tools_tricu_bridge.py +++ b/llm_tools_tricu_bridge.py @@ -14,12 +14,8 @@ def tricubridge(input: str) -> str: text=True, check=True, ) - - if len(result.stdout) > 2000: - return "Output too large; limited to 2000 chars." - else: - return result.stdout.strip() - + output = result.stdout.strip() + return output[:500] + ('...' if len(output) > 500 else '') except subprocess.CalledProcessError as e: return f"Error executing Tricu code: {e.stderr or str(e)}" except Exception as e: