Text Generation
PEFT
Safetensors
English
tool-calling
function-calling
voice-agent
phone-agent
customer-service
inkling
lora
qlora
unsloth
actuate
conversational
Instructions to use srinath-exe/Actuate-Inkling-2-Mini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use srinath-exe/Actuate-Inkling-2-Mini with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Inkling-2-Mini-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "srinath-exe/Actuate-Inkling-2-Mini") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Desktop
Download actuate_parse.py from srinath-exe/Actuate-Inkling-2-Mini: direct link, hf CLI and curl.
- Browser
- Download file 2.57 kB
-
https://huggingface.co/srinath-exe/Actuate-Inkling-2-Mini/resolve/main/actuate_parse.py
- Command line
-
hf download hf://srinath-exe/Actuate-Inkling-2-Mini/actuate_parse.py
-
curl -L -o actuate_parse.py https://huggingface.co/srinath-exe/Actuate-Inkling-2-Mini/resolve/main/actuate_parse.py
2.57 kB
| """Split a Actuate model's raw output into tool calls + the sentence to speak. | |
| from actuate_parse import parse | |
| out = parse("lfm3", raw_text) # kind: "lfm3" | "spark" | "inkling" | |
| out["calls"] -> [{"name": "find_patient", "arguments": {"phone": "512 555 0142"}}] | |
| out["say"] -> "Let me check that for you." | |
| Each model keeps its base model's native tool-call format, so this is the same parsing the base models need. | |
| """ | |
| import json | |
| import re | |
| def _val(v): | |
| v = v.strip() | |
| try: | |
| return json.loads(v) | |
| except (json.JSONDecodeError, ValueError): | |
| return v | |
| def parse(kind, text): | |
| calls, say = [], text | |
| if kind == "lfm3": # <tool_call><function=name><parameter=key>value</parameter></function></tool_call> | |
| for blk in re.findall(r"<tool_call>(.*?)(?:</tool_call>|$)", text, re.S): | |
| m = re.search(r"<function=([^>\s]+)>(.*?)(?:</function>|$)", blk, re.S) | |
| if m: | |
| args = {k: _val(v) for k, v in re.findall(r"<parameter=([^>\s]+)>\n?(.*?)\n?</parameter>", m.group(2), re.S)} | |
| calls.append({"name": m.group(1).strip(), "arguments": args}) | |
| say = re.sub(r"<tool_call>.*?(</tool_call>|$)", "", text, flags=re.S) | |
| elif kind == "spark": # <tool_call>name<arg_key>key</arg_key><arg_value>value</arg_value></tool_call> | |
| for blk in re.findall(r"<tool_call>(.*?)(?:</tool_call>|$)", text, re.S): | |
| name = blk.split("<arg_key>")[0].strip() | |
| args = {k.strip(): _val(v) for k, v in re.findall(r"<arg_key>(.*?)</arg_key>\s*<arg_value>(.*?)</arg_value>", blk, re.S)} | |
| if name: | |
| calls.append({"name": name, "arguments": args}) | |
| say = re.sub(r"<tool_call>.*?(</tool_call>|$)", "", text, flags=re.S) | |
| elif kind == "inkling": # <|message_model|>name<|content_invoke_tool_json|>{"name": ..., "args": {...}} | |
| for m in re.finditer(r"<\|content_invoke_tool_json\|>(\{.*?\})\s*(?:<\|end_message\|>|$)", text, re.S): | |
| try: | |
| j = json.loads(m.group(1)) | |
| calls.append({"name": j.get("name"), "arguments": j.get("args") or {}}) | |
| except json.JSONDecodeError: | |
| pass | |
| parts = re.split(r"<\|message_model\|>", text) | |
| say = " ".join(re.sub(r"<\|[a-z_]+\|>", " ", p) for p in parts if "<|content_invoke_tool_json|>" not in p) | |
| say = re.sub(r"<think>.*?</think>", "", say, flags=re.S) | |
| say = re.sub(r"<\|[^|>]+\|>|</?think>", " ", say) | |
| return {"calls": calls, "say": re.sub(r"\s+", " ", say).strip()} | |