Failed to parse chat template

#1
by ben-epstein - opened

I'm seeing this on download

{% for message in messages %}{% if (message['role'] == 'system') %}{{'<|im_start|>system<|im_sep|>' + message['content'] + '<|im_end|>'}}{% elif (message['role'] == 'user') %}{{'<|im_start|>user<|im_sep|>' + message['content'] + '<|im_end|><|im_start|>assistant<|im_sep|>'}}{% elif (message['role'] == 'assistant') %}{{message['content'] + '<|im_end|>'}}{% endif %}{% endfor %}

But i'm seeing Syntax error: 1:136 Unexpected token '}'. Expected '>'.

Not quite seeing the issue, but this also seems like the old chat template: https://docs.gpt4all.io/gpt4all_desktop/chat_templates.html#what-changed-in-gpt4all-v35

GPT4All-Community org

When using this model with GPT4All

{{- '<|im_start|>system<|im_sep|>' }}
{% if toolList|length > 0 %}You have access to the following functions:
{% for tool in toolList %}
Use the function '{{tool.function}}' to: '{{tool.description}}'
{% if tool.parameters|length > 0 %}
parameters:
{% for info in tool.parameters %}
  {{info.name}}:
    type: {{info.type}}
    description: {{info.description}}
    required: {{info.required}}
{% endfor %}
{% endif %}
# Tool Instructions
If you CHOOSE to call this function ONLY reply with the following format:
'{{tool.symbolicFormat}}'
Here is an example. If the user says, '{{tool.examplePrompt}}', then you reply
'{{tool.exampleCall}}'
After the result you might reply with, '{{tool.exampleReply}}'
{% endfor %}
You MUST include both the start and end tags when you use a function.

You are a helpful AI assistant who uses the functions to break down, analyze, perform, and verify complex reasoning tasks. You SHOULD try to verify your answers using the functions where possible.
{% endif %}
{{- '<|im_end|>' }}
{% for message in messages %}
  {% if (message['role'] == 'system') %}
    {{ '<|im_start|>system<|im_sep|>' + message['content'] + '<|im_end|>' }}
  {% elif (message['role'] == 'user') %}
    {{ '<|im_start|>user<|im_sep|>' + message['content'] + '<|im_end|><|im_start|>assistant<|im_sep|>' }}
  {% elif (message['role'] == 'assistant') %}
    {{ message['content'] + '<|im_end|>' }}
  {% endif %}
{% endfor %}

I'm seeing this on download

Yes the original template is in the gguf, the one you want to use is now above.

But i'm seeing Syntax error: 1:136 Unexpected token '}'. Expected '>'.

Because the original template is not formatted for GPT4All, and the model has not been uploaded officially yet. If it is included as an official supported model the template will be changed by GPT4All.

Sign up or log in to comment