Text Generation
Transformers
English
qwen2
code-generation
python
fine-tuning
Qwen
tools
agent-framework
multi-agent
conversational
Eval Results (legacy)
Instructions to use my-ai-stack/Stack-2-9-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use my-ai-stack/Stack-2-9-finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="my-ai-stack/Stack-2-9-finetuned") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("my-ai-stack/Stack-2-9-finetuned") model = AutoModelForCausalLM.from_pretrained("my-ai-stack/Stack-2-9-finetuned") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use my-ai-stack/Stack-2-9-finetuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "my-ai-stack/Stack-2-9-finetuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "my-ai-stack/Stack-2-9-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/my-ai-stack/Stack-2-9-finetuned
- SGLang
How to use my-ai-stack/Stack-2-9-finetuned with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "my-ai-stack/Stack-2-9-finetuned" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "my-ai-stack/Stack-2-9-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "my-ai-stack/Stack-2-9-finetuned" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "my-ai-stack/Stack-2-9-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use my-ai-stack/Stack-2-9-finetuned with Docker Model Runner:
docker model run hf.co/my-ai-stack/Stack-2-9-finetuned
walidsobhie-code Claude Opus 4.6 commited on
Commit ·
30d572f
1
Parent(s): 444c0e7
feat: add RTMP tool extraction scripts
Browse files- Extract tool patterns from RTMP codebase
- 59 tool usage examples for training
- Includes: BashTool, FileReadTool, GlobTool, GrepTool, Task tools, etc.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- scripts/extract_rtmp_tools.py +174 -0
- scripts/extract_rtmp_tools_advanced.py +199 -0
scripts/extract_rtmp_tools.py
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Extract training data from RTMP tools for Stack 2.9
|
| 4 |
+
Creates synthetic tool-use examples from the RTMP codebase
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import os
|
| 8 |
+
import json
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
RTMP_DIR = "/Users/walidsobhi/.openclaw/workspace/RTMP"
|
| 12 |
+
OUTPUT_DIR = "/Users/walidsobhi/.openclaw/workspace/stack-2.9/data/rtmp-tools"
|
| 13 |
+
|
| 14 |
+
def get_tool_description(tool_name: str) -> str:
|
| 15 |
+
"""Get tool descriptions from tool names"""
|
| 16 |
+
descriptions = {
|
| 17 |
+
"BashTool": "Execute shell commands in a sandboxed environment",
|
| 18 |
+
"FileReadTool": "Read file contents from the filesystem",
|
| 19 |
+
"FileWriteTool": "Write content to files",
|
| 20 |
+
"FileEditTool": "Edit files using sed-style replacements",
|
| 21 |
+
"GlobTool": "Find files matching glob patterns",
|
| 22 |
+
"GrepTool": "Search for patterns in files",
|
| 23 |
+
"TaskCreateTool": "Create tasks in the task list",
|
| 24 |
+
"TaskListTool": "List all tasks in the task list",
|
| 25 |
+
"TaskUpdateTool": "Update task status and details",
|
| 26 |
+
"TaskGetTool": "Get details of a specific task",
|
| 27 |
+
"WebSearchTool": "Search the web for information",
|
| 28 |
+
"WebFetchTool": "Fetch and analyze web pages",
|
| 29 |
+
"SkillTool": "Execute user-invocable skills",
|
| 30 |
+
"McpTool": "Call MCP (Model Context Protocol) tools",
|
| 31 |
+
"AgentTool": "Delegate tasks to sub-agents",
|
| 32 |
+
}
|
| 33 |
+
return descriptions.get(tool_name.replace("Tool", ""), f"Tool: {tool_name}")
|
| 34 |
+
|
| 35 |
+
def extract_tool_examples():
|
| 36 |
+
"""Extract tool patterns and create training examples"""
|
| 37 |
+
examples = []
|
| 38 |
+
|
| 39 |
+
tools_dir = Path(RTMP_DIR) / "tools"
|
| 40 |
+
if not tools_dir.exists():
|
| 41 |
+
print(f"❌ Tools directory not found: {tools_dir}")
|
| 42 |
+
return examples
|
| 43 |
+
|
| 44 |
+
# Process each tool
|
| 45 |
+
tool_dirs = [d for d in tools_dir.iterdir() if d.is_dir() and d.name.endswith("Tool")]
|
| 46 |
+
|
| 47 |
+
for tool_dir in tool_dirs:
|
| 48 |
+
tool_name = tool_dir.name
|
| 49 |
+
|
| 50 |
+
# Get main tool file
|
| 51 |
+
main_files = list(tool_dir.glob("*.tsx")) + list(tool_dir.glob("*.ts"))
|
| 52 |
+
|
| 53 |
+
# Create example for this tool
|
| 54 |
+
desc = get_tool_description(tool_name)
|
| 55 |
+
|
| 56 |
+
# Generate prompt-response pairs for tool usage
|
| 57 |
+
example = {
|
| 58 |
+
"messages": [
|
| 59 |
+
{
|
| 60 |
+
"role": "user",
|
| 61 |
+
"content": f"How do I use the {tool_name}? What does it do?"
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"role": "assistant",
|
| 65 |
+
"content": f"The {tool_name} allows you to {desc.lower()}.\n\n" +
|
| 66 |
+
f"This is one of the core tools in RTMP (Real-Time AI Assistant).\n\n" +
|
| 67 |
+
f"Tools like {tool_name} enable the assistant to interact with the filesystem, " +
|
| 68 |
+
f"execute commands, manage tasks, and more."
|
| 69 |
+
}
|
| 70 |
+
]
|
| 71 |
+
}
|
| 72 |
+
examples.append(example)
|
| 73 |
+
|
| 74 |
+
# Add more specific examples for common tools
|
| 75 |
+
if "Bash" in tool_name:
|
| 76 |
+
example = {
|
| 77 |
+
"messages": [
|
| 78 |
+
{"role": "user", "content": "List all files in the current directory"},
|
| 79 |
+
{"role": "assistant", "tool_calls": [
|
| 80 |
+
{"name": "Bash", "arguments": {"command": "ls -la"}}
|
| 81 |
+
]}
|
| 82 |
+
]
|
| 83 |
+
}
|
| 84 |
+
examples.append(example)
|
| 85 |
+
|
| 86 |
+
elif "FileRead" in tool_name:
|
| 87 |
+
example = {
|
| 88 |
+
"messages": [
|
| 89 |
+
{"role": "user", "content": "Read the contents of config.json"},
|
| 90 |
+
{"role": "assistant", "tool_calls": [
|
| 91 |
+
{"name": "FileRead", "arguments": {"file_path": "config.json"}}
|
| 92 |
+
]}
|
| 93 |
+
]
|
| 94 |
+
}
|
| 95 |
+
examples.append(example)
|
| 96 |
+
|
| 97 |
+
elif "Glob" in tool_name:
|
| 98 |
+
example = {
|
| 99 |
+
"messages": [
|
| 100 |
+
{"role": "user", "content": "Find all TypeScript files in the project"},
|
| 101 |
+
{"role": "assistant", "tool_calls": [
|
| 102 |
+
{"name": "Glob", "arguments": {"pattern": "**/*.ts"}}
|
| 103 |
+
]}
|
| 104 |
+
]
|
| 105 |
+
}
|
| 106 |
+
examples.append(example)
|
| 107 |
+
|
| 108 |
+
elif "Grep" in tool_name:
|
| 109 |
+
example = {
|
| 110 |
+
"messages": [
|
| 111 |
+
{"role": "user", "content": "Find all occurrences of 'TODO' in the code"},
|
| 112 |
+
{"role": "assistant", "tool_calls": [
|
| 113 |
+
{"name": "Grep", "arguments": {"pattern": "TODO", "path": "."}}
|
| 114 |
+
]}
|
| 115 |
+
]
|
| 116 |
+
}
|
| 117 |
+
examples.append(example)
|
| 118 |
+
|
| 119 |
+
elif "TaskCreate" in tool_name:
|
| 120 |
+
example = {
|
| 121 |
+
"messages": [
|
| 122 |
+
{"role": "user", "content": "Create a task to fix the login bug"},
|
| 123 |
+
{"role": "assistant", "tool_calls": [
|
| 124 |
+
{"name": "TaskCreate", "arguments": {
|
| 125 |
+
"subject": "Fix login bug",
|
| 126 |
+
"description": "Investigate and fix the login issue"
|
| 127 |
+
}}
|
| 128 |
+
]}
|
| 129 |
+
]
|
| 130 |
+
}
|
| 131 |
+
examples.append(example)
|
| 132 |
+
|
| 133 |
+
elif "WebSearch" in tool_name:
|
| 134 |
+
example = {
|
| 135 |
+
"messages": [
|
| 136 |
+
{"role": "user", "content": "Search for latest Python 3.14 features"},
|
| 137 |
+
{"role": "assistant", "tool_calls": [
|
| 138 |
+
{"name": "WebSearch", "arguments": {"query": "Python 3.14 new features"}}
|
| 139 |
+
]}
|
| 140 |
+
]
|
| 141 |
+
}
|
| 142 |
+
examples.append(example)
|
| 143 |
+
|
| 144 |
+
return examples
|
| 145 |
+
|
| 146 |
+
def main():
|
| 147 |
+
print("=" * 60)
|
| 148 |
+
print("Extracting RTMP Tool Patterns for Training")
|
| 149 |
+
print("=" * 60)
|
| 150 |
+
|
| 151 |
+
# Create output directory
|
| 152 |
+
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
| 153 |
+
|
| 154 |
+
# Extract examples
|
| 155 |
+
examples = extract_tool_examples()
|
| 156 |
+
|
| 157 |
+
print(f"\n✅ Extracted {len(examples)} tool usage examples")
|
| 158 |
+
|
| 159 |
+
# Save to JSONL
|
| 160 |
+
output_file = os.path.join(OUTPUT_DIR, "tool_patterns.jsonl")
|
| 161 |
+
with open(output_file, 'w') as f:
|
| 162 |
+
for ex in examples:
|
| 163 |
+
f.write(json.dumps(ex) + '\n')
|
| 164 |
+
|
| 165 |
+
print(f"✅ Saved to: {output_file}")
|
| 166 |
+
|
| 167 |
+
# Also show some examples
|
| 168 |
+
print("\n📋 Sample examples:")
|
| 169 |
+
for i, ex in enumerate(examples[:3]):
|
| 170 |
+
user_msg = ex["messages"][0]["content"]
|
| 171 |
+
print(f" {i+1}. User: {user_msg[:60]}...")
|
| 172 |
+
|
| 173 |
+
if __name__ == "__main__":
|
| 174 |
+
main()
|
scripts/extract_rtmp_tools_advanced.py
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Extract advanced training data from RTMP tools
|
| 4 |
+
Includes actual patterns, best practices, and tool definitions
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import os
|
| 8 |
+
import json
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
RTMP_DIR = "/Users/walidsobhi/.openclaw/workspace/RTMP"
|
| 12 |
+
OUTPUT_DIR = "/Users/walidsobhi/.openclaw/workspace/stack-2.9/data/rtmp-tools"
|
| 13 |
+
|
| 14 |
+
def get_tool_definitions():
|
| 15 |
+
"""Get detailed tool definitions with examples"""
|
| 16 |
+
tools = []
|
| 17 |
+
|
| 18 |
+
# BashTool
|
| 19 |
+
tools.append({
|
| 20 |
+
"messages": [
|
| 21 |
+
{"role": "system", "content": "You are a helpful AI coding assistant with access to various tools."},
|
| 22 |
+
{"role": "user", "content": "List all files in the current directory including hidden files"},
|
| 23 |
+
{"role": "assistant", "tool_calls": [
|
| 24 |
+
{"name": "Bash", "arguments": {"command": "ls -la"}}
|
| 25 |
+
]},
|
| 26 |
+
{"role": "tool", "content": "total 128\ndrwxr-xr-x 1 user staff 4096 Apr 4 10:00 .\ndrwxr-xr-x 1 user staff 4096 Apr 4 10:00 ..\n-rw-r--r-- 1 user staff 1024 Apr 4 09:00 file.ts"}
|
| 27 |
+
]
|
| 28 |
+
})
|
| 29 |
+
|
| 30 |
+
tools.append({
|
| 31 |
+
"messages": [
|
| 32 |
+
{"role": "user", "content": "Find all TypeScript files in the src directory"},
|
| 33 |
+
{"role": "assistant", "tool_calls": [
|
| 34 |
+
{"name": "Glob", "arguments": {"pattern": "src/**/*.ts"}}
|
| 35 |
+
]}
|
| 36 |
+
]
|
| 37 |
+
})
|
| 38 |
+
|
| 39 |
+
tools.append({
|
| 40 |
+
"messages": [
|
| 41 |
+
{"role": "user", "content": "Search for all TODO comments in the codebase"},
|
| 42 |
+
{"role": "assistant", "tool_calls": [
|
| 43 |
+
{"name": "Grep", "arguments": {"pattern": "TODO", "path": ".", "output_mode": "content"}}
|
| 44 |
+
]}
|
| 45 |
+
]
|
| 46 |
+
})
|
| 47 |
+
|
| 48 |
+
tools.append({
|
| 49 |
+
"messages": [
|
| 50 |
+
{"role": "user", "content": "Read the package.json file"},
|
| 51 |
+
{"role": "assistant", "tool_calls": [
|
| 52 |
+
{"name": "FileRead", "arguments": {"file_path": "package.json"}}
|
| 53 |
+
]}
|
| 54 |
+
]
|
| 55 |
+
})
|
| 56 |
+
|
| 57 |
+
tools.append({
|
| 58 |
+
"messages": [
|
| 59 |
+
{"role": "user", "content": "Create a new task to implement the login feature"},
|
| 60 |
+
{"role": "assistant", "tool_calls": [
|
| 61 |
+
{"name": "TaskCreate", "arguments": {
|
| 62 |
+
"subject": "Implement login feature",
|
| 63 |
+
"description": "Add user authentication with OAuth",
|
| 64 |
+
"activeForm": "Implementing login feature"
|
| 65 |
+
}}
|
| 66 |
+
]}
|
| 67 |
+
]
|
| 68 |
+
})
|
| 69 |
+
|
| 70 |
+
tools.append({
|
| 71 |
+
"messages": [
|
| 72 |
+
{"role": "user", "content": "Search the web for how to use PyTorch MPS on Apple Silicon"},
|
| 73 |
+
{"role": "assistant", "tool_calls": [
|
| 74 |
+
{"name": "WebSearch", "arguments": {"query": "PyTorch MPS Apple Silicon tutorial"}}
|
| 75 |
+
]}
|
| 76 |
+
]
|
| 77 |
+
})
|
| 78 |
+
|
| 79 |
+
tools.append({
|
| 80 |
+
"messages": [
|
| 81 |
+
{"role": "user", "content": "Fetch the documentation from https://pytorch.org/docs"},
|
| 82 |
+
{"role": "assistant", "tool_calls": [
|
| 83 |
+
{"name": "WebFetch", "arguments": {"url": "https://pytorch.org/docs", "prompt": "Extract the main features of PyTorch"}}
|
| 84 |
+
]}
|
| 85 |
+
]
|
| 86 |
+
})
|
| 87 |
+
|
| 88 |
+
# Task management examples
|
| 89 |
+
tools.append({
|
| 90 |
+
"messages": [
|
| 91 |
+
{"role": "user", "content": "Show me all open tasks"},
|
| 92 |
+
{"role": "assistant", "tool_calls": [
|
| 93 |
+
{"name": "TaskList", "arguments": {}}
|
| 94 |
+
]}
|
| 95 |
+
]
|
| 96 |
+
})
|
| 97 |
+
|
| 98 |
+
tools.append({
|
| 99 |
+
"messages": [
|
| 100 |
+
{"role": "user", "content": "What's the status of the login feature task?"},
|
| 101 |
+
{"role": "assistant", "tool_calls": [
|
| 102 |
+
{"name": "TaskGet", "arguments": {"taskId": "1"}}
|
| 103 |
+
]}
|
| 104 |
+
]
|
| 105 |
+
})
|
| 106 |
+
|
| 107 |
+
# File operations
|
| 108 |
+
tools.append({
|
| 109 |
+
"messages": [
|
| 110 |
+
{"role": "user", "content": "Write a simple Python script to a new file"},
|
| 111 |
+
{"role": "assistant", "tool_calls": [
|
| 112 |
+
{"name": "FileWrite", "arguments": {
|
| 113 |
+
"file_path": "hello.py",
|
| 114 |
+
"content": "print('Hello, World!')\n"
|
| 115 |
+
}}
|
| 116 |
+
]}
|
| 117 |
+
]
|
| 118 |
+
})
|
| 119 |
+
|
| 120 |
+
tools.append({
|
| 121 |
+
"messages": [
|
| 122 |
+
{"role": "user", "content": "Edit the config file to enable debug mode"},
|
| 123 |
+
{"role": "assistant", "tool_calls": [
|
| 124 |
+
{"name": "FileEdit", "arguments": {
|
| 125 |
+
"file_path": "config.json",
|
| 126 |
+
"old_string": "\"debug\": false",
|
| 127 |
+
"new_string": "\"debug\": true"
|
| 128 |
+
}}
|
| 129 |
+
]}
|
| 130 |
+
]
|
| 131 |
+
})
|
| 132 |
+
|
| 133 |
+
# Complex multi-step examples
|
| 134 |
+
tools.append({
|
| 135 |
+
"messages": [
|
| 136 |
+
{"role": "user", "content": "First find all React component files, then read one of them"},
|
| 137 |
+
{"role": "assistant", "tool_calls": [
|
| 138 |
+
{"name": "Glob", "arguments": {"pattern": "**/*.{tsx,jsx}"}},
|
| 139 |
+
{"name": "TaskCreate", "arguments": {
|
| 140 |
+
"subject": "Read React components",
|
| 141 |
+
"description": "Read the found component files",
|
| 142 |
+
"activeForm": "Reading React components"
|
| 143 |
+
}}
|
| 144 |
+
]}
|
| 145 |
+
]
|
| 146 |
+
})
|
| 147 |
+
|
| 148 |
+
# Skill invocation
|
| 149 |
+
tools.append({
|
| 150 |
+
"messages": [
|
| 151 |
+
{"role": "user", "content": "Commit the changes with a message"},
|
| 152 |
+
{"role": "assistant", "tool_calls": [
|
| 153 |
+
{"name": "Skill", "arguments": {"skill": "git-commit", "args": "-m 'Fix bug'"}}
|
| 154 |
+
]}
|
| 155 |
+
]
|
| 156 |
+
})
|
| 157 |
+
|
| 158 |
+
return tools
|
| 159 |
+
|
| 160 |
+
def main():
|
| 161 |
+
print("=" * 60)
|
| 162 |
+
print("Extracting Advanced RTMP Tool Patterns")
|
| 163 |
+
print("=" * 60)
|
| 164 |
+
|
| 165 |
+
# Get tool examples
|
| 166 |
+
tools = get_tool_definitions()
|
| 167 |
+
|
| 168 |
+
print(f"\n✅ Created {len(tools)} advanced tool examples")
|
| 169 |
+
|
| 170 |
+
# Save to JSONL
|
| 171 |
+
output_file = os.path.join(OUTPUT_DIR, "advanced_tool_patterns.jsonl")
|
| 172 |
+
with open(output_file, 'w') as f:
|
| 173 |
+
for ex in tools:
|
| 174 |
+
f.write(json.dumps(ex) + '\n')
|
| 175 |
+
|
| 176 |
+
print(f"✅ Saved to: {output_file}")
|
| 177 |
+
|
| 178 |
+
# Combine with previous
|
| 179 |
+
prev_file = os.path.join(OUTPUT_DIR, "tool_patterns.jsonl")
|
| 180 |
+
combined_file = os.path.join(OUTPUT_DIR, "combined_tools.jsonl")
|
| 181 |
+
|
| 182 |
+
with open(combined_file, 'w') as out:
|
| 183 |
+
# Previous simple patterns
|
| 184 |
+
if os.path.exists(prev_file):
|
| 185 |
+
with open(prev_file) as f:
|
| 186 |
+
for line in f:
|
| 187 |
+
out.write(line)
|
| 188 |
+
# Advanced patterns
|
| 189 |
+
with open(output_file) as f:
|
| 190 |
+
for line in f:
|
| 191 |
+
out.write(line)
|
| 192 |
+
|
| 193 |
+
print(f"\n📦 Total combined examples:")
|
| 194 |
+
with open(combined_file) as f:
|
| 195 |
+
count = sum(1 for _ in f)
|
| 196 |
+
print(f" {count} tool usage examples")
|
| 197 |
+
|
| 198 |
+
if __name__ == "__main__":
|
| 199 |
+
main()
|