Skip to content

Tool calling does not work #334

Closed
Closed

Description

@odlg

Using Eullm with Jetbrains IntelliJ and a plugin called DevoxxGenie does not work. When the llm wants to call a tool, that is not understood by DevoxxGenie.
Image
Also, it seems that antml:thinking is not understood/forwarded correctly.

Using llama.cpp DevoxxGenie is able to call tools and also show the thinking in a separate box:
Image

Activity

  1. primoco commented on Aug 9, 2026

    @primoco
    Collaborator

    You found a gap, not a bug, and the honest version is short: the OpenAI endpoint ignores tools entirely. The request parses, the field is dropped, the model never learns the tools exist. Whatever tool-call markup it produces anyway goes out as plain content, which is exactly the wall of text in your first screenshot. Reasoning has the same shape: llama-server splits it into reasoning_content, which is what DevoxxGenie renders as a separate box; we stream it inline.

    The reason llama.cpp gets this right is common_chat — the machinery that renders tools into the model's own template and parses the reply back into structured tool_calls, per template family. Since 0.6.70 we already use that same machinery for chat template rendering, so the fix is wiring through the two halves we don't call yet: pass tools/tool_choice into the render, run the output through common_chat_parse, and emit tool_calls and reasoning_content where the spec puts them. Same parser llama-server uses, so a model that tool-calls correctly there should behave the same here.

    Scheduled for the next release window (0.6.80). No workaround in the meantime worth pretending about: DevoxxGenie needs structured tool_calls, and today we don't produce them. I'll post here when there is a build worth testing — your IntelliJ setup is the reference client for this one, if you're willing to run it again.

  2. primoco commented on Aug 9, 2026

    @primoco
    Collaborator

    Tool calling is in, as of v0.6.80-rc2.

    What you found was a gap, not a bug: the OpenAI endpoint dropped tools on the floor, the model never learned they existed, and whatever call markup it produced anyway went out as plain content the wall of text in your screenshot. Reasoning had the same shape: llama-server splits it into reasoning_content, we streamed it inline.

    Both halves now go through the same machinery llama-server uses. The request's own OpenAI JSON tool definitions, tool role messages, assistant tool_calls in the history is rendered through the model's chat template, and the raw output is parsed back with llama.cpp's format-aware parser into structured tool_calls, content and reasoning_content, with finish_reason: "tool_calls" when the model called something. A model that tool-calls correctly against llama-server should behave the same here.

    Verified with curl against Qwen3.6-27B: asked "Che tempo fa a Milano?" with a get_weather tool, got finish_reason: "tool_calls", content: null, arguments: {"city":"Milano"}, and the whole thinking process in reasoning_content where your separate box expects it.

    Two limits worth naming before you test. Tool requests are parsed whole, so a streaming request gets its answer as one delta rather than token-by-token valid OpenAI streaming, just coarse; incremental tool-call streaming is separate work. And it needs a model whose GGUF embeds a chat template (Qwen3 family and most modern releases do); without one, tools are ignored with a logged warning, since there is no reliable way to teach an unknown template to call tools.

    Your IntelliJ + DevoxxGenie setup is the reference client for this one it exercises the full loop, tool result back into the history included, which curl alone does not. If you can run it against rc2 and post what happens either way, that closes this out.

  3. odlg commented on Aug 9, 2026

    @odlg
    Author

    Thanks for fast response.
    It is a lot better. It now calls tools, and it mostly works. Though this appears in the output with the result:
    Image

    The last output from eullm is this:

    2026-08-09T16:39:10.918740Z  INFO eullm::api::routes: Request params: max_tokens=4294967295, temp=0.00, top_k=40, top_p=0.90, repeat_penalty=1.10, num_ctx=None
    2026-08-09T16:39:11.349387Z  WARN eullm::inference: num_predict capped: requested=4294967295, effective=238972 (context=256000, prompt_tokens=17028)
    2026-08-09T16:39:11.349410Z  INFO eullm::inference: Stream: prompt=17028 tokens, max_output=238972, effective_ctx=256000
    2026-08-09T16:41:17.715146Z  INFO eullm::audit: Audit: inference logged audit_id=6c594e79-3a27-4511-8784-4e2b3178d050 model=ornith-1.0-35b-gguf-ud-q5_k_xl request_type=chat.completions input_tokens=17028 output_tokens=1306 duration_ms=126796
    2026-08-09T16:41:17.827395Z  INFO eullm::api::routes: Request params: max_tokens=4294967295, temp=0.00, top_k=40, top_p=0.90, repeat_penalty=1.10, num_ctx=None
    2026-08-09T16:41:18.261063Z  WARN eullm::inference: num_predict capped: requested=4294967295, effective=238633 (context=256000, prompt_tokens=17367)
    2026-08-09T16:41:18.261088Z  INFO eullm::inference: Stream: prompt=17367 tokens, max_output=238633, effective_ctx=256000
    2026-08-09T16:43:43.430836Z  INFO eullm::audit: Audit: inference logged audit_id=1ba5c934-c551-447a-9259-84f859a9fc5d model=ornith-1.0-35b-gguf-ud-q5_k_xl request_type=chat.completions input_tokens=17367 output_tokens=1636 duration_ms=145603
    2026-08-09T16:43:43.433134Z  WARN eullm::inference: chat output parse failed, treating as plain text: llama.cpp raised an exception while rendering the chat template
    common_chat_peg_parse: unparsed peg-native output: <tool_call>
    <function=search_files>
    <parameter=file_pattern>
    *.java
    </parameter>
    <parameter=pattern>
    getAccountType\(\)
    </parameter>
    </function>
    </tool_call>
    
  4. primoco commented on Aug 9, 2026

    @primoco
    Collaborator

    That log line was exactly what I needed, thanks.

    What happened: the first round parsed fine, DevoxxGenie ran the tool and sent the result back. On the second round the model wrapped its call in text the strict grammar did not expect, and the strict parse of a complete reply throws on any unparsed remainder, even when the tool_call block inside it was recognized correctly. Our fallback then dumped the raw markup into content, which is the text you saw in the output.

    Fixed in v0.6.80-rc6: when the strict parse rejects a complete reply, the parser retries in salvage mode, which keeps whatever the grammar did recognize instead of throwing everything away. Your second-round output has a well-formed <tool_call> block in it, so the salvage should extract it. Only a reply where nothing parses at all still falls back to plain text.

    If you can run the same session against rc6, I expect the loop to hold across rounds. If you still see markup in the output, the same WARN line from the server log is again the most useful thing you can post.

  5. odlg commented on Aug 9, 2026

    @odlg
    Author

    It stops at the same point. In DevoxxGenie it looks exactly the same. The output from eullm is:

    2026-08-09T17:38:21.946369Z  INFO eullm::api::routes: Request params: max_tokens=4294967295, temp=0.00, top_k=40, top_p=0.90, repeat_penalty=1.10, num_ctx=None
    2026-08-09T17:38:22.380007Z  WARN eullm::inference: num_predict capped: requested=4294967295, effective=238972 (context=256000, prompt_tokens=17028)
    2026-08-09T17:38:22.380029Z  INFO eullm::inference: Stream: prompt=17028 tokens, max_output=238972, effective_ctx=256000
    2026-08-09T17:40:28.903986Z  INFO eullm::audit: Audit: inference logged audit_id=06e0edfe-35b6-437f-b7c8-3ceef5a3333e model=ornith-1.0-35b-gguf-ud-q5_k_xl request_type=chat.completions input_tokens=17028 output_tokens=1306 duration_ms=126957
    2026-08-09T17:40:28.996509Z  INFO eullm::api::routes: Request params: max_tokens=4294967295, temp=0.00, top_k=40, top_p=0.90, repeat_penalty=1.10, num_ctx=None
    2026-08-09T17:40:29.446897Z  WARN eullm::inference: num_predict capped: requested=4294967295, effective=238633 (context=256000, prompt_tokens=17367)
    2026-08-09T17:40:29.446922Z  INFO eullm::inference: Stream: prompt=17367 tokens, max_output=238633, effective_ctx=256000
    2026-08-09T17:42:54.475638Z  INFO eullm::audit: Audit: inference logged audit_id=38f3f7e1-f378-4ce4-89ba-4c8ba4ee466b model=ornith-1.0-35b-gguf-ud-q5_k_xl request_type=chat.completions input_tokens=17367 output_tokens=1636 duration_ms=145478
    common_chat_peg_parse: unparsed peg-native output: <tool_call>
    <function=search_files>
    <parameter=file_pattern>
    *.java
    </parameter>
    <parameter=pattern>
    getAccountType\(\)
    </parameter>
    </function>
    </tool_call>
    2026-08-09T17:42:54.543813Z  WARN eullm::inference: chat output parse failed, treating as plain text: llama.cpp raised an exception in the chat template engine
    
  6. primoco commented on Aug 9, 2026

    @primoco
    Collaborator

    The grammar rejects your output in both parse modes, so the rc6 salvage had nothing to work with. As far as I can tell the model is following its template correctly and the parser is wrong, so rc8 stops relying on it: when the parse fails, a plain scanner picks up well-formed <tool_call> blocks and returns them structured. Your exact output from the log is now a test case.

    rc8 also fixes a sizing bug on your model: the GGUF has no full_attention_interval key, so --fit was overestimating the KV cache. It now uses the same default llama.cpp applies.

    If you can rerun the session on rc8, that should tell us if this closes.

  7. odlg commented on Aug 9, 2026

    @odlg
    Author

    It completes the job now. It still logs some warnings.

    2026-08-09T18:37:53.070257Z  INFO eullm::inference: Stream: prompt=17367 tokens, max_output=238633, effective_ctx=256000
    2026-08-09T18:40:17.416506Z  INFO eullm::audit: Audit: inference logged audit_id=fb4c416a-75da-41b3-aa68-e4304b302425 model=ornith-1.0-35b-gguf-ud-q5_k_xl request_type=chat.completions input_tokens=17367 output_tokens=1636 duration_ms=144778
    common_chat_peg_parse: unparsed peg-native output: <tool_call>
    <function=search_files>
    <parameter=file_pattern>
    *.java
    </parameter>
    <parameter=pattern>
    getAccountType\(\)
    </parameter>
    </function>
    </tool_call>
    2026-08-09T18:40:17.420702Z  WARN eullm::inference: chat output parse failed (llama.cpp raised an exception in the chat template engine); recovered 1 tool call(s) with the native-syntax extractor
    2026-08-09T18:40:17.526718Z  INFO eullm::api::routes: Request params: max_tokens=4294967295, temp=0.00, top_k=40, top_p=0.90, repeat_penalty=1.10, num_ctx=None
    2026-08-09T18:40:17.966046Z  WARN eullm::inference: num_predict capped: requested=4294967295, effective=236254 (context=256000, prompt_tokens=19746)
    2026-08-09T18:40:17.966070Z  INFO eullm::inference: Stream: prompt=19746 tokens, max_output=236254, effective_ctx=256000
    2026-08-09T18:41:34.942169Z  INFO eullm::audit: Audit: inference logged audit_id=66fd48ef-41d4-451d-8fd0-55fae00644ff model=ornith-1.0-35b-gguf-ud-q5_k_xl request_type=chat.completions input_tokens=19746 output_tokens=72 duration_ms=77415
    2026-08-09T18:41:35.003999Z  INFO eullm::api::routes: Request params: max_tokens=4294967295, temp=0.00, top_k=40, top_p=0.90, repeat_penalty=1.10, num_ctx=None
    2026-08-09T18:41:35.519685Z  WARN eullm::inference: num_predict capped: requested=4294967295, effective=234262 (context=256000, prompt_tokens=21738)
    2026-08-09T18:41:35.519705Z  INFO eullm::inference: Stream: prompt=21738 tokens, max_output=234262, effective_ctx=256000
    2026-08-09T18:43:04.234287Z  INFO eullm::audit: Audit: inference logged audit_id=50aff883-5a9f-49d9-8d82-5671cf6fb804 model=ornith-1.0-35b-gguf-ud-q5_k_xl request_type=chat.completions input_tokens=21738 output_tokens=129 duration_ms=89229
    common_chat_peg_parse: unparsed peg-native output: <tool_call>
    <function=read_file>
    <parameter=path>
    src/main/java/coXXXXXXXXXXXXin/AccountsActionBean.java
    </parameter>
    <parameter=line>
    385
    </parameter>
    </function>
    </tool_call>
    2026-08-09T18:43:04.237265Z  WARN eullm::inference: chat output parse failed (llama.cpp raised an exception in the chat template engine); recovered 1 tool call(s) with the native-syntax extractor
    2026-08-09T18:43:04.307303Z  INFO eullm::api::routes: Request params: max_tokens=4294967295, temp=0.00, top_k=40, top_p=0.90, repeat_penalty=1.10, num_ctx=None
    2026-08-09T18:43:04.753948Z  WARN eullm::inference: num_predict capped: requested=4294967295, effective=228677 (context=256000, prompt_tokens=27323)
    2026-08-09T18:43:04.753971Z  INFO eullm::inference: Stream: prompt=27323 tokens, max_output=228677, effective_ctx=256000
    2026-08-09T18:48:51.116335Z  INFO eullm::audit: Audit: inference logged audit_id=20570b19-02f6-483e-ac9b-bb75d4089278 model=ornith-1.0-35b-gguf-ud-q5_k_xl request_type=chat.completions input_tokens=27323 output_tokens=4457 duration_ms=346808
    

    It feels faster now also.

    Btw.

    1. I can not shift between models hf.co/unsloth/Ornith-1.0-35B-GGUF:UD-Q5_K_XL and hf.co/unsloth/Ornith-1.0-35B-GGUF:UD-Q4_K_M - it sees them as the same?
    2. If I try to start hf.co/unsloth/Ornith-1.0-35B-GGUF:UD-Q4_K_M and later starts it with hf.co/unsloth/Ornith-1.0-35B-GGUF it starts to download hf.co/unsloth/Ornith-1.0-35B-GGUF:UD-Q4_K_M
  8. primoco commented on Aug 9, 2026

    @primoco
    Collaborator

    Good. The warnings are expected: the grammar still rejects those outputs, the extractor recovers the call, and the WARN line is the trace of that. It stays visible until the upstream parser learns this format; I prefer logging it to hiding it.

    The speed difference is real. Your GGUF has no full_attention_interval key, and before rc8 the sizer overestimated the KV cache four times over on this architecture, keeping layers off the GPU that had room.

    The two model switching problems are real bugs, and new to us: the :QUANT suffix gets flattened when the name is normalized, so both quants collapse into one identity, and the bare repo name resolves back to a quant you already have. Tracked. If you can open a dedicated issue for them, even better, it keeps this one about tool calling, which your log says is done.

  9. odlg commented on Aug 10, 2026

    @odlg
    Author

    I created #345

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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