Instructions to use Nanthasit/sakthai-context-0.5b-tools with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nanthasit/sakthai-context-0.5b-tools with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nanthasit/sakthai-context-0.5b-tools") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Nanthasit/sakthai-context-0.5b-tools") model = AutoModelForCausalLM.from_pretrained("Nanthasit/sakthai-context-0.5b-tools", device_map="auto") 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 Settings
- vLLM
How to use Nanthasit/sakthai-context-0.5b-tools with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Nanthasit/sakthai-context-0.5b-tools" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nanthasit/sakthai-context-0.5b-tools", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Nanthasit/sakthai-context-0.5b-tools
- SGLang
How to use Nanthasit/sakthai-context-0.5b-tools 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 "Nanthasit/sakthai-context-0.5b-tools" \ --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": "Nanthasit/sakthai-context-0.5b-tools", "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 "Nanthasit/sakthai-context-0.5b-tools" \ --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": "Nanthasit/sakthai-context-0.5b-tools", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Nanthasit/sakthai-context-0.5b-tools with Docker Model Runner:
docker model run hf.co/Nanthasit/sakthai-context-0.5b-tools
SakThai Context 0.5B — Tools
Ultra-light tool-calling agent · Qwen2.5-0.5B fine-tune · runs in ~1 GB RAM
NEW (2026-08-01): Added "Quick Example" section — copy-paste 30-second working code showing tool calling in action.
SakThai Context 0.5B Tools is the v4 release of the tool-calling agent — fine-tuned from Qwen2.5-0.5B-Instruct with prompt-masked SFT. It achieves 91.2% selection accuracy (multiset-corrected scorer) on the SakThai Bench v2, a 2.3× improvement over the 40.2% baseline.
Quick Example
Get a working tool-calling agent in 30 seconds:
import json
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Nanthasit/sakthai-context-0.5b-tools"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
# Define available tools
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather",
"parameters": {
"type": "object",
"properties": {"location": {"type": "string"}},
"required": ["location"]
}
}
}
]
# Build conversation
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What's the weather in Tokyo?"}
]
# Generate
text = tokenizer.apply_chat_template(messages, tools=tools, tokenize=False, add_generation_prompt=True)
inputs = tokenizer([text], return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=100, temperature=0.01)
# Parse tool call
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
if "<tool_call>" in response:
json_str = response.split("<tool_call>")[1].split("</tool_call>")[0]
tool_call = json.loads(json_str)
print(f"✓ Tool: {tool_call['name']}, args: {tool_call['arguments']}")
Expected: ✓ Tool: get_weather, args: {'location': 'Tokyo'}
This snippet loads the model, formats a conversation with tools, generates a response, and extracts the structured tool call. Works on CPU — edit device_map="cpu" if needed.
Full card (benchmarks, training details, family table, etc.) continues below.
- Downloads last month
- 251
Model tree for Nanthasit/sakthai-context-0.5b-tools
Datasets used to train Nanthasit/sakthai-context-0.5b-tools
Nanthasit/sakthai-bench-v2
Spaces using Nanthasit/sakthai-context-0.5b-tools 2
Collections including Nanthasit/sakthai-context-0.5b-tools
Evaluation results
- Selection Accuracy on SakThai Bench v2 (500 rows, scorer multiset-selection-v2)self-reported91.200
- Arguments Accuracy on SakThai Bench v2 (500 rows, scorer multiset-selection-v2)self-reported45.700
- Strict Accuracy on SakThai Bench v2 (500 rows, scorer multiset-selection-v2)self-reported45.700
- Held-Out Tool Accuracy on SakThai Bench v2 (500 rows, scorer multiset-selection-v2)self-reported87.800
- Degenerate Outputs on SakThai Bench v2 (500 rows, scorer multiset-selection-v2)self-reported0.000