FunctionGemma Mobile Actions v5 - GGUF

GGUF quantized versions of FunctionGemma Mobile Actions v5 for use with llama.cpp, Ollama, LM Studio, and other GGUF-compatible tools.

Available Quantizations

File Size Description Use Case
functiongemma-v5-Q8_0.gguf ~290 MB 8-bit quantization Best quality, recommended for most uses
functiongemma-v5-Q4_K_M.gguf ~170 MB 4-bit quantization Good balance of quality and size

Supported Functions

Function Description Example Input
set_alarm Set alarms "Wake me up at 7am"
create_reminder Create reminders "Remind me to buy milk"
set_timer Set countdown timers "Timer for 10 minutes"
make_call Make phone calls "Call Mom"
send_message Send text messages "Text John I'm running late"
create_calendar_event Schedule events "Schedule meeting at 3pm"
play_music Play music "Play some jazz"
get_weather Get weather info "What's the weather like?"
open_app Open applications "Open the camera"
navigate Get directions "Navigate to the airport"
set_volume Adjust volume "Turn the volume up"
calculator Math calculations "What's 15 times 23?"

Usage with llama.cpp

Download

# Using huggingface-cli
huggingface-cli download essobi/functiongemma-mobile-actions-v5-gguf functiongemma-v5-Q8_0.gguf --local-dir .

# Or with wget
wget https://huggingface.co/essobi/functiongemma-mobile-actions-v5-gguf/resolve/main/functiongemma-v5-Q8_0.gguf

CLI Inference

# Simple inference
./llama-cli -m functiongemma-v5-Q8_0.gguf -p "<start_of_turn>user
Set an alarm for 7am<end_of_turn>
<start_of_turn>model
" -n 100 --temp 0.1

# With full prompt format (recommended)
./llama-cli -m functiongemma-v5-Q8_0.gguf \
  --prompt "<start_of_turn>developer
Current date and time given in YYYY-MM-DDTHH:MM:SS format: 2025-01-26T10:30:00
Day of week is Sunday
You are a model that can do function calling with the following functions<start_function_declaration>declaration:set_alarm{description:<escape>Sets an alarm for a specific time.<escape>,parameters:{properties:{datetime:{description:<escape>The time for the alarm.<escape>,type:<escape>STRING<escape>}},required:[<escape>datetime<escape>],type:<escape>OBJECT<escape>}}<end_function_declaration><end_of_turn>
<start_of_turn>user
Wake me up at 7am tomorrow<end_of_turn>
<start_of_turn>model
" \
  -n 100 --temp 0.1

llama.cpp Server

# Start the server
./llama-server -m functiongemma-v5-Q8_0.gguf --port 8080

# Query via curl
curl http://localhost:8080/completion \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "<start_of_turn>user\nRemind me to buy milk<end_of_turn>\n<start_of_turn>model\n",
    "n_predict": 100,
    "temperature": 0.1
  }'

Python with llama-cpp-python

pip install llama-cpp-python
from llama_cpp import Llama
from datetime import datetime

# Load model
llm = Llama(
    model_path="functiongemma-v5-Q8_0.gguf",
    n_ctx=4096,
    n_gpu_layers=-1,  # Use GPU if available
)

def build_prompt(user_input: str, tools: list) -> str:
    """Build prompt in FunctionGemma format."""
    now = datetime.now()
    dt_str = now.strftime("%Y-%m-%dT%H:%M:%S")
    day = now.strftime("%A")
    
    # Build function declarations
    func_decls = ""
    for tool in tools:
        func = tool["function"]
        props = func["parameters"].get("properties", {})
        required = func["parameters"].get("required", [])
        
        props_str = ""
        for pname, pinfo in props.items():
            desc = pinfo.get("description", "")
            ptype = pinfo.get("type", "STRING")
            props_str += f"{pname}:{{description:<escape>{desc}<escape>,type:<escape>{ptype}<escape>}},"
        props_str = props_str.rstrip(",")
        
        req_str = ",".join([f"<escape>{r}<escape>" for r in required])
        
        func_decls += f"<start_function_declaration>declaration:{func['name']}{{description:<escape>{func['description']}<escape>,parameters:{{properties:{{{props_str}}},required:[{req_str}],type:<escape>OBJECT<escape>}}}}<end_function_declaration>"
    
    return f"""<start_of_turn>developer
Current date and time given in YYYY-MM-DDTHH:MM:SS format: {dt_str}
Day of week is {day}
You are a model that can do function calling with the following functions{func_decls}<end_of_turn>
<start_of_turn>user
{user_input}<end_of_turn>
<start_of_turn>model
"""

# Define tools
tools = [
    {
        "function": {
            "name": "set_alarm",
            "description": "Sets an alarm for a specific time.",
            "parameters": {
                "type": "OBJECT",
                "properties": {
                    "datetime": {"type": "STRING", "description": "The time for the alarm."},
                },
                "required": ["datetime"]
            }
        }
    },
    {
        "function": {
            "name": "create_reminder",
            "description": "Creates a reminder with text and optional time.",
            "parameters": {
                "type": "OBJECT",
                "properties": {
                    "body": {"type": "STRING", "description": "The reminder text."},
                },
                "required": ["body"]
            }
        }
    },
]

# Generate
prompt = build_prompt("Set an alarm for 7am", tools)
output = llm(prompt, max_tokens=100, temperature=0.1, stop=["<end_of_turn>"])

print(output["choices"][0]["text"])
# Output: <start_function_call>call:set_alarm{datetime:<escape>7am<escape>}<end_function_call>

Usage with Ollama

Create Modelfile

# Modelfile
FROM ./functiongemma-v5-Q8_0.gguf

TEMPLATE """<start_of_turn>user
{{ .Prompt }}<end_of_turn>
<start_of_turn>model
"""

PARAMETER temperature 0.1
PARAMETER stop <end_of_turn>
PARAMETER stop <end_function_call>

Run with Ollama

# Create the model
ollama create functiongemma -f Modelfile

# Run inference
ollama run functiongemma "Set an alarm for 7am"

Usage with LM Studio

  1. Download functiongemma-v5-Q8_0.gguf
  2. Open LM Studio and import the model
  3. Use the chat interface with the prompt format shown above

Output Format

The model outputs function calls in this format:

<start_function_call>call:function_name{param1:<escape>value1<escape>,param2:<escape>value2<escape>}<end_function_call>

Parsing Function Calls

import re

def parse_function_call(text: str) -> dict | None:
    """Parse function call from model output."""
    match = re.search(
        r'<start_function_call>call:(\w+)\{([^}]*)\}<end_function_call>', 
        text
    )
    if not match:
        return None
    
    func_name = match.group(1)
    args_str = match.group(2)
    
    # Parse arguments
    args = {}
    for param_match in re.finditer(r'(\w+):<escape>([^<]*)<escape>', args_str):
        args[param_match.group(1)] = param_match.group(2)
    
    return {"name": func_name, "arguments": args}

# Example
output = "<start_function_call>call:set_alarm{datetime:<escape>7am<escape>}<end_function_call>"
parsed = parse_function_call(output)
print(parsed)
# {'name': 'set_alarm', 'arguments': {'datetime': '7am'}}

Performance

Quantization File Size Memory Usage Quality
Q8_0 ~290 MB ~350 MB Excellent
Q4_K_M ~170 MB ~220 MB Very Good

Limitations

  • Optimized for English only
  • Best for single-turn function calling
  • May struggle with highly ambiguous requests

License

This model is released under the Gemma License.

Related Models

Downloads last month
8
GGUF
Model size
0.3B params
Architecture
gemma3
Hardware compatibility
Log In to add your hardware

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for essobi/functiongemma-mobile-actions-v5-gguf

Quantized
(186)
this model

Dataset used to train essobi/functiongemma-mobile-actions-v5-gguf