Run this model with HF Jobs
Run Cialtion/SimpleTool on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/Cialtion/SimpleTool. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Cialtion/SimpleTool on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/Cialtion/SimpleTool. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/Cialtion/SimpleTool. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use Cialtion/SimpleTool with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Cialtion/SimpleTool with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Cialtion/SimpleTool")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Cialtion/SimpleTool", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Cialtion/SimpleTool with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Cialtion/SimpleTool" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Cialtion/SimpleTool", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Cialtion/SimpleTool
- SGLang
How to use Cialtion/SimpleTool 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 "Cialtion/SimpleTool" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Cialtion/SimpleTool", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Cialtion/SimpleTool" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Cialtion/SimpleTool", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Cialtion/SimpleTool with Docker Model Runner:
docker model run hf.co/Cialtion/SimpleTool
Update .ipynb_checkpoints/simpletool-game.skill-checkpoint.md
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318# SimpleTool Skill β Real-Time AI Application Development
> **This is a skill file.** Feed it to any AI coding assistant (Claude, Gemini, GPT, Cursor, etc.) as context, then describe the app you want. The AI will generate a working SimpleTool-powered application.>> Example prompt: *"Read the attached SimpleTool skill, then build me a Pong game where AI controls one paddle in real-time."*
---
## 1. What is SimpleTool?
SimpleTool is a **multi-head parallel decoding** server for real-time LLM function calling. It runs on vLLM and decodes function name + arguments simultaneously instead of sequentially.
```Traditional: function β arg1 β arg2 β ... (sequential, ~200-500ms)SimpleTool: [function, arg1, arg2, ...] (parallel, ~25-60ms)```
**Application domains**: game AI, robotic arm control, digital human animation, IoT automation β anything that needs < 100ms LLM decision-making.
## 2. Server API
Server default: `http://localhost:8899`
### Endpoints| Method | Path | Description ||--------|------|-------------|| GET | `/health` | Health check, returns `{status, version, model}` || POST | `/v1/function_call` | Multi-head parallel function call |
### Request Format (v2)```javascript{ messages: [{role: 'user', content: 'your query'}], tools: [...], // OpenAI-format tool definitions system: "domain prompt", // Domain-specific system prompt (v2) environment: [...], // Current state info (string array, optional) history: [...], // Action history (string array, max 6) include_content_head: false // Whether to generate <content> head}```
The `system` field lets you inject a domain-specific system prompt (e.g., "You are a robotic arm controller"). If omitted, the server uses a generic default. The `environment` field is optional context folded into the user message.
### Response Format```javascript{ success: true, function: "move", args: {direction: "up", speed: "fast"}, // Named args (param names from tool def) heads: { // Raw per-head output function: "move", arg1: "up", arg2: "fast", arg3: "<|null|>" }, content: null, // Only if include_content_head was true latency_ms: 35.2}```
## 3. Dynamic Head Count (Critical for Latency!)
**The server automatically prunes unused heads.** If your tools have at most 2 parameters, only 3 heads are spawned (`<function>`, `<arg1>`, `<arg2>`), not 8. This saves ~40% latency.
```Active heads = [<function>] + [<arg1>...<argN>]where N = max parameter count across all tool definitions```
**Design tip**: Keep your tools to 1β3 parameters when possible. Fewer params = fewer heads = lower latency.
## 4. Tool Definition
### Constraints- Maximum **6 arguments** per function (arg1βarg6)- Arguments map to `arg1, arg2, ...` in the order defined in `properties`- Server auto-converts types: numeric strings β int/float, otherwise lowercase string- Use `enum` to constrain options β this dramatically improves accuracy
### Template```javascriptconst TOOLS = [{ type: "function", function: { name: "action_name", description: "Clear, concise β what this action does and when to use it", parameters: { type: "object", properties: { param1: { type: "string", enum: ["opt_a", "opt_b", "opt_c"], // Constrain! Improves accuracy description: "What this param controls" }, param2: { type: "number", description: "Numeric value with unit, e.g. 'Force in Newtons'" } }, required: ["param1"] } }}];```
### Multi-Tool Example (Game)```javascriptconst TOOLS = [ {type:"function", function:{name:"move", description:"Move unit to position", parameters:{type:"object", properties:{unit:{type:"string"}, target:{type:"string", enum:["north","south","east","west"]}}}}}, {type:"function", function:{name:"attack", description:"Attack enemy", parameters:{type:"object", properties:{unit:{type:"string"}, target:{type:"string"}}}}}, {type:"function", function:{name:"retreat", description:"Pull back unit", parameters:{type:"object", properties:{unit:{type:"string"}}}}}, {type:"function", function:{name:"pass", description:"Do nothing this turn", parameters:{type:"object", properties:{}}}}];// Max params = 2 β only 3 heads spawned```
## 5. Query Design
### Principles1. **Be imperative** β tell the model what to decide, not just describe state2. **Include decision context** β "Ball is BELOW paddle, intercept it" not "Ball y=250"3. **List valid options** β "Choose: up/down/stay"4. **Keep it short** β shorter query = faster prefill
### Good vs Bad```β
"Ball 50px BELOW paddle, approaching fast. Move DOWN to intercept. Choose: up/down/stay"β "Ball position: 250, Paddle position: 200. What should I do?"
β
"Red gear at (300,150,50). Move arm there slowly for pickup."β "There is a gear somewhere on the table. The arm needs to go to it."
β
"Stream starting, viewers saying hello. Greet them warmly."β "Viewers are in the chat. Do something appropriate."```
### Environment & History```javascript// Environment: current state as key=value stringsconst env = [ `ball_y=${ballY}`, `paddle_y=${paddleY}`, `gap=${gap}`, `approaching=true`];
// History: recent actions (max 6, server trims automatically)const history = [ "move(up)", "move(up)", "stay()"];```
### Domain System Prompts (v2)For v2 server, set a domain-specific system prompt:```javascript// Game AIconst SYSTEM = "You are the AI controller for a Pong game. Move the paddle to intercept the ball. React quickly.";
// Robotic armconst SYSTEM = "You are the voice controller for a 6-axis robotic arm. Convert commands to precise function calls. Coordinates in mm.";
// Digital humanconst SYSTEM = "You are the animation controller for a virtual streamer. Convert director instructions to expression and speech calls.";```
## 6. Frontend Code Standards
### Required: Type-Safe Value Extraction```javascript// Values in args may be int, not string β always coercefunction safeStr(v) { if (v === null || v === undefined) return ''; return String(v).trim().toLowerCase();}
// Extract with args (named) first, heads (positional) as fallbacklet direction = safeStr(d.args?.direction) || safeStr(d.heads?.arg1);```
### Required: Validate Return Values```javascriptconst VALID = ['up', 'down', 'stay'];if (!VALID.includes(direction)) { console.warn(`Invalid: "${direction}", fallback to stay`); direction = 'stay';}```
### Required: Error Handling with Fallback```javascriptasync function callAI() { try { const r = await fetch(SERVER_URL + '/v1/function_call', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(request) }); const data = await r.json(); if (!data.success) throw new Error(data.error); applyAction(data); } catch (e) { console.error('[AI] Failed:', e); applyFallbackAI(); // MUST have fallback β never freeze the app }}```
### Required: Logging```javascriptconsole.log(`[Game] Query: ${query}`);console.log(`[Game] β ${data.function}(${JSON.stringify(data.args)}) ${data.latency_ms.toFixed(0)}ms`);```
### Recommended: Debug UI OverlayShow in a corner of your app: current query, raw response, latency (current + rolling average).
## 7. Game Loop Pattern
**Decouple AI from rendering.** The AI loop runs at 10β16 Hz; the render loop runs at 60 fps.
```javascriptconst AI_INTERVAL = 100; // 100ms = 10 Hzlet aiPending = false;
// Render loop (60fps) β never blocks on AIfunction gameLoop() { update(); render(); requestAnimationFrame(gameLoop);}
// AI loop (async, non-blocking)async function aiLoop() { if (aiPending) return; aiPending = true; await callAI(); aiPending = false;}
setInterval(aiLoop, AI_INTERVAL);gameLoop();```
## 8. FCClient Template
Drop-in client class for any HTML/JS application:
```javascriptclass FCClient { constructor(url = 'http://localhost:8899') { this.url = url.replace(/\/$/, ''); }
async health() { try { const r = await fetch(`${this.url}/health`, {signal: AbortSignal.timeout(3000)}); const d = await r.json(); return {ok: d.loaded === true || d.status === 'ok', version: d.version}; } catch (e) { return {ok: false}; } }
async call({query, tools, system, env, history, includeContent = false}) { const t0 = performance.now(); try { const r = await fetch(`${this.url}/v1/function_call`, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ messages: [{role: 'user', content: query}], tools, system, // v2: domain system prompt environment: env, history, include_content_head: includeContent }) }); const d = await r.json(); return {...d, wall_ms: performance.now() - t0}; } catch (e) { return {success: false, error: e.message, wall_ms: performance.now() - t0}; } }}```
Usage:```javascriptconst ai = new FCClient('http://localhost:8899');
const result = await ai.call({ query: "Ball is BELOW. Move down. Choose: up/down/stay", tools: TOOLS, system: "You are a Pong AI. Move paddle to intercept ball.", env: ["ball_y=300", "paddle_y=200", "gap=100"], history: ["move(down)", "move(down)"]});
if (result.success) { console.log(`${result.function}(${JSON.stringify(result.args)}) in ${result.latency_ms}ms`);}```
## 9. Troubleshooting
| Symptom | Cause | Fix ||---------|-------|-----|| AI stuck / no movement | Query too vague | Add decision hints: "Move DOWN to intercept" || `.trim is not a function` | `args` values may be int | Use `String(v)` before `.trim()` || High latency (>100ms) | Too many heads / long query | Reduce tool params, shorten query/env || Wrong function called | Ambiguous tool descriptions | Add `enum`, improve `description` fields || `<|null|>` in all args | Model confused | Check tool param order matches expectations |
---
**Skill Version**: 2.0 β Supports v1/v2 server, multi-domain (game, robotics, avatar) **Last Updated**: 2026-03.ipynb_checkpoints/simpletool-game.skill-checkpoint.mdAdded+318