Files
letta-server/tests/test_tool_sandbox/restaurant_management_system/test.py
Kian Jones ca6cfa5914 chore: migrate to ruff (#4305)
* base requirements

* autofix

* Configure ruff for Python linting and formatting

- Set up minimal ruff configuration with basic checks (E, W, F, I)
- Add temporary ignores for common issues during migration
- Configure pre-commit hooks to use ruff with pass_filenames
- This enables gradual migration from black to ruff

* Delete sdj

* autofixed only

* migrate lint action

* more autofixed

* more fixes

* change precommit

* try changing the hook

* try this stuff
2025-08-29 11:11:19 -07:00

26 lines
931 B
Python

import os
import runpy
def generate_and_execute_tool(tool_name: str, args: dict):
# Define the tool's directory and file
tools_dir = os.path.join(os.path.dirname(__file__), "tools")
script_path = os.path.join(tools_dir, f"{tool_name}_execution.py")
# Generate the Python script
with open(script_path, "w") as script_file:
script_file.write(f"from restaurant_management_system.tools.{tool_name} import {tool_name}\n\n")
arg_str = ", ".join([f"{key}={repr(value)}" for key, value in args.items()])
script_file.write("if __name__ == '__main__':\n")
script_file.write(f" result = {tool_name}({arg_str})\n")
script_file.write(" print(result)\n")
# Execute the script
runpy.run_path(script_path, run_name="__main__")
# Optional: Clean up generated script
# os.remove(script_path)
generate_and_execute_tool("adjust_menu_prices", {"percentage": 10})