Use of "parameters" or "arguments" in chat template

#31
by mbayser - opened

In the chat template most of the time the word "paratemeters" is used. However, in two places the tool_call dict is expected to have an arguments entry, like here:

            {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
            {{- '{"name": "' + tool_call.name + '", ' }}
            {{- '"parameters": ' }}
            {{- tool_call.arguments | tojson }}
            {{- "}" }}

In my tests the model generates JSON output using the word "parameters", and if you try to load the response directly with json.loads() and add the dict to the messages array you will get a key error when the chat template is applied.

For example:

    messages.append({
        "role": "assistant",
        "tool_calls": [{"type": "function", "function": json.loads('{"name": "add_habit", "parameters": {"name": "Reading a book", "repeat_frequency": "[\\"MONDAY\\", \\"TUESDAY\\", \\"WEDNESDAY\\", \\"THURSDAY\\", \\"FRIDAY\\"]", "tags": "[\\"learning\\"]"}}')}],
    })

Is there one right word or should both be supported?

Sign up or log in to comment