Spaces:
Running
Running
| import asyncio | |
| import os | |
| from reachy_mini_danceml.movement_generator import MovementGenerator | |
| from reachy_mini_danceml.realtime_handler import RealtimeHandler, SYSTEM_INSTRUCTIONS | |
| # Mock Generator | |
| class MockGenerator(MovementGenerator): | |
| def __init__(self): | |
| pass | |
| async def stop(self): | |
| pass | |
| async def test_generative_tools(): | |
| print("--- Testing Hybrid Generative Tools ---") | |
| # Init Handler | |
| handler = RealtimeHandler(openai_key="fake-key", movement_generator=MockGenerator()) | |
| # 1. Test get_choreography_guide | |
| print("\n[Test] Calling 'get_choreography_guide'...") | |
| # Emulate tool call | |
| result = await handler.handle_tool_call("get_choreography_guide", {}) | |
| if "Error" in result: | |
| print(f"FAIL: {result}") | |
| # Hint: check if we are running from root | |
| print(f"CWD: {os.getcwd()}") | |
| else: | |
| print(f"SUCCESS: Retrieved guide ({len(result)} chars)") | |
| print(f"Snippet: {result[:100]}...") | |
| assert "Reachy Mini Choreography Guide" in result | |
| # 2. Check System Instructions for Router Logic | |
| print("\n[Test] Checking System Instructions...") | |
| if "get_choreography_guide" in SYSTEM_INSTRUCTIONS: | |
| print("SUCCESS: System instructions mention the guide tool.") | |
| else: | |
| print("FAIL: System instructions missing router logic reference.") | |
| if __name__ == "__main__": | |
| asyncio.run(test_generative_tools()) | |