Update Jinja template for Jinja version compatibility

#13
by rshcao - opened
No description provided.

Any way to get a raw copy of this template? I'm hoping it might help resolve issues I've had with tool calling in tools like RooCode. (Unless it's the same one from Unsloth: it still doesn't work well in RooCode with Llama.cpp.)

Having the same issues. Tool calling is all wrong and hasn't worked once. Running Ollama 0.11.3, RooCode 3.25.9. And the tool calling is missing the outer wrappers for tool calling.

Example Output:

Let me read one of these files to understand its structure and then document it according to the template. I'll start with the first one.
<read_file path="Databases/Queries/avgFltHrs.md"/>

Whereas devstral produces the correct tool use:

Let me read one of these files to understand its structure and then document it according to the template. I'll start with the first one.
<read_file>
<args>
<file>
<path="Databases/Queries/avgFltHrs.md"/>
</file>
</args>
</read_file>

The XML-format raw output for Qwen should work like this: (assistant output for the case you provided above)

<tool_call>
<function=read_file>
<parameter=path>
Databases/Queries/avgFltHrs.md
</parameter>
</function>
</tool_call>

Notice that:

  1. LLM does not need to predict the double quotes for path "Databases/Queries/avgFltHrs.md". This can prevent the notorious problem of escaping characters in multi-line code.
  2. We constrain XML tags only to the special format <function=xxx></function> and <parameter=xxx></parameter>.
    That is, we do not use the function name or parameter name itself as XML tags (like the case you provided <read_file> and <file>) to prevent the potential risk incurred by arbitrary tags definition. Arbitrary XML tags will easily cause nested parsing conflicts or difficulty when the parameter value itself is XML code.
Publish this branch
This branch is in draft mode, publish it to be able to merge.

Sign up or log in to comment