Skip to content

ai/functiongemma tool calls are not parsed into tool_calls #1045

Description

@yohasebe

Summary

ai/functiongemma emits well-formed tool-call tokens in its own format, but Docker Model Runner does not parse them:

  • tool_calls stays null and the raw <start_function_call>…<end_function_call> text is returned in message.content;
  • <end_function_call> is not treated as a stop token, so the call repeats until max_tokens and finish_reason is "length".

There is no error. To a client, the response looks like the model simply did not use the tool.

Steps to reproduce

docker model pull ai/functiongemma

curl -s http://localhost:12434/engines/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ai/functiongemma",
    "max_tokens": 400,
    "messages": [{"role":"user","content":"What is the current time? Use the get_time tool."}],
    "tools": [{"type":"function","function":{
      "name":"get_time","description":"Get the current time",
      "parameters":{"type":"object","properties":{}}}}]
  }' | jq '.choices[0]'

Actual

tool_calls    : null
finish_reason : "length"
content       : "<start_function_call>call:get_time{}<end_function_call>call:get_time{}<end_function_call>call:get_ti…"

Expected

tool_calls populated, finish_reason: "tool_calls", and no call tokens in content. For comparison, an equivalent request to Ollama returns:

{"tool_calls": [{"id": "call_o3fkhnnc", "function": {"name": "get_time", "arguments": {}}}]}

with content empty.

Suggested resolution

Parse the <start_function_call>…<end_function_call> format into tool_calls and treat <end_function_call> as a stop token.

Related: #1046. /api/show exposes no capabilities, so a client also cannot check for tool support before making the request.

Environment

  • Model Runner client v1.2.6, Docker Desktop engine 29.7.2
  • Backend llama.cpp b9879-metal, macOS, Apple Silicon
  • Model: ai/functiongemma

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions