Jinja Prompt fix for Tool use not working in LM-Studio

#1
by panclamor - opened

Solution to tool call error that tested and works.
Seems the other zecanard gemma prompts are missing the same block.

Received error when trying to use tools:

Failed to regenerate messageError rendering prompt with jinja template: "Cannot call something that is not a function: got UndefinedValue".

Found solution is to update the jinja prompt template with:

{%- macro format_type_argument(type_value) -%}
    {%- if type_value is string -%}
        {{- type_value | lower -}}
    {%- elif type_value is iterable -%}
        {{- '[' -}}
        {%- for t in type_value -%}
            {{- t | lower -}}
            {%- if not loop.last %},{% endif -%}
        {%- endfor -%}
        {{- ']' -}}
    {%- else -%}
        {{- type_value -}}
    {%- endif -%}
{%- endmacro -%}

Needs to be added to jinja prompt before:

{%- macro strip_thinking(text) -%}

Doh! I wish I would have known this before I re-synced all my Gemma 4s with Google's chat template. Thanks for the heads up. I have updated my quants.

Sign up or log in to comment