Skip to content

Commit

Permalink
a few more tweaks to the 3.2 template
Browse files Browse the repository at this point in the history
Signed-off-by: Travis Johnson <[email protected]>
  • Loading branch information
tjohnson31415 committed Nov 19, 2024
1 parent ad1a2f7 commit 41e41aa
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions examples/tool_chat_template_llama3.2_json.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
{{- "Cutting Knowledge Date: December 2023\n" }}
{{- "Today Date: " + date_string + "\n\n" }}
{%- if tools is not none and not tools_in_user_message %}
{{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
{{- ' Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
{{- " Do not use variables.\n\n" }}
{{- "You have access to the following functions. To call a function, please respond with JSON for a function call. " }}
{{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. ' }}
{{- "Do not use variables.\n\n" }}
{%- for t in tools %}
{{- t | tojson(indent=4) }}
{{- "\n\n" }}
Expand All @@ -80,16 +80,15 @@
{%- else %}
{%- set first_user_message = messages[0]['content']['text']|trim %}
{%- endif %}
{%- set first_user_message = messages[0]['content']|trim %}
{%- set messages = messages[1:] %}
{%- else %}
{{- raise_exception("Cannot put tools in the first user message when there's no first user message!") }}
{%- endif %}
{{- '<|start_header_id|>user<|end_header_id|>\n\n' -}}
{{- "Given the following functions, please respond with a JSON for a function call " }}
{{- "with its proper arguments that best answers the given prompt.\n\n" }}
{{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
{{- " Do not use variables.\n\n" }}
{{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. ' }}
{{- "Do not use variables.\n\n" }}
{%- for t in tools %}
{{- t | tojson(indent=4) }}
{{- "\n\n" }}
Expand Down Expand Up @@ -125,10 +124,10 @@
{{- "<|eot_id|>" }}
{%- elif message.role == "tool" or message.role == "ipython" %}
{{- "<|start_header_id|>ipython<|end_header_id|>\n\n" }}
{%- if message.content is mapping %}
{{- message.content | tojson }}
{%- else %}
{%- if message.content is string %}
{{- { "output": message.content } | tojson }}
{%- else %}
{{- message.content | tojson }}
{%- endif %}
{{- "<|eot_id|>" }}
{%- endif %}
Expand Down

0 comments on commit 41e41aa

Please sign in to comment.