Coverage for integrations / service_tools / acestep_tool.py: 70.0%

10 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-05-12 04:49 +0000

1""" 

2AceStep 1.5 tool wrapper — AI music generation. 

3 

4Service: ACE-Step 1.5 (https://github.com/ace-step/ACE-Step-1.5) 

5Default port: 8001 

6Deployment: uv run acestep-api --port 8001 

7Note: Must run with workers=1 (in-memory job queue not shared across workers) 

8""" 

9 

10from .registry import ServiceToolInfo, service_tool_registry 

11 

12 

13class AceStepTool: 

14 """Thin wrapper to register AceStep 1.5 with the ServiceToolRegistry.""" 

15 

16 DEFAULT_URL = "http://localhost:8001" 

17 

18 @classmethod 

19 def create_tool_info(cls, base_url: str = None) -> ServiceToolInfo: 

20 return ServiceToolInfo( 

21 name="acestep", 

22 description=( 

23 "AI music generation. Creates songs from text prompts with lyrics, " 

24 "genre, tempo, and instrumentation control. Generates full songs " 

25 "in under 10 seconds on consumer hardware." 

26 ), 

27 base_url=base_url or cls.DEFAULT_URL, 

28 endpoints={ 

29 "generate": { 

30 "path": "/release_task", 

31 "method": "POST", 

32 "description": ( 

33 "Submit a music generation task. " 

34 "Input: JSON with 'prompt' (lyrics/description), " 

35 "'genre' (pop/rock/jazz/etc), 'tempo' (BPM, default 120), " 

36 "'duration' (seconds, default 30). " 

37 "Returns task_id to check result with query_result endpoint." 

38 ), 

39 "params_schema": { 

40 "prompt": {"type": "string", "description": "Music prompt with lyrics and style"}, 

41 "genre": {"type": "string", "description": "Music genre (pop, rock, jazz, classical, etc.)"}, 

42 "tempo": {"type": "integer", "description": "BPM tempo", "default": 120}, 

43 "duration": {"type": "integer", "description": "Duration in seconds", "default": 30}, 

44 }, 

45 }, 

46 "check_result": { 

47 "path": "/query_result", 

48 "method": "POST", 

49 "description": ( 

50 "Check status and get result of a music generation task. " 

51 "Input: JSON with 'task_id' (string from release_task). " 

52 "Returns generation status and audio URL when complete." 

53 ), 

54 "params_schema": { 

55 "task_id": {"type": "string", "description": "Task ID from generate endpoint"}, 

56 }, 

57 }, 

58 }, 

59 health_endpoint="/health", 

60 tags=["music", "audio", "generation", "singing"], 

61 timeout=120, 

62 ) 

63 

64 @classmethod 

65 def register(cls, base_url: str = None) -> bool: 

66 """Register AceStep with the global service_tool_registry.""" 

67 tool_info = cls.create_tool_info(base_url) 

68 return service_tool_registry.register_tool(tool_info)