Spaces:
Sleeping
Sleeping
| import asyncio | |
| from app.services.repl import repl_service | |
| from app.services.rlm import rlm_service | |
| async def main(): | |
| print("=== ORA REPL & RLM Verification ===") | |
| # 1. Basic REPL test | |
| print("\n1. Testing basic REPL (Math/Logic)...") | |
| code = "x = 10\ny = 20\nprint(f'{x} + {y} = {x+y}')" | |
| res = repl_service.execute(code) | |
| print(f" Output: {res['output'].strip()}") | |
| # 2. Safety Test | |
| print("\n2. Testing Safety (Attempting to import OS)...") | |
| unsafe_code = "import os\nprint(os.name)" | |
| res = repl_service.execute(unsafe_code) | |
| if not res["success"]: | |
| print(f" [SAFE] Blocked/Failed correctly: {res['error'].splitlines()[-1]}") | |
| else: | |
| print(f" [DANGER] OS access was allowed!") | |
| # 3. RLM Test (Requires Mock LLM to cooperate) | |
| # We update mock logic to handle "calculate" keywords | |
| print("\n3. Testing RLM (Reasoning Loop)...") | |
| problem = "Calculate the number of days between the destruction of the first temple (586 BC) and the second temple (70 AD)." | |
| # Note: Mock LLM needs a fallback for this to work in offline mode | |
| print(" (Verifying code generation -> execution flow)") | |
| reasoning_result = await rlm_service.reason(problem) | |
| print(f" RLM Final Result: {reasoning_result.strip()}") | |
| if __name__ == "__main__": | |
| asyncio.run(main()) | |