LLM for the Greek language,available in [F16, q8_0, q6_K, q4_K_S]
tools
19 Pulls Updated 6 weeks ago
f82a3e345bd0 · 2.7kB
{{- /* Variable setup */ -}}
{{ $tools := .Tools }}
{{ $tools_in_user_message := true }}
{{ $date_string := "26 Jul 2024" }}
{{ $system_message := "" }}
{{ $messages := .Messages }}
{{- /* Extract system message if the first message is 'system' */ -}}
{{ if and (gt (len .Messages) 0) (eq (index .Messages 0).Role "system") }}
{{ $system_message = (index .Messages 0).Content }}
{{ $messages = slice .Messages 1 }}
{{ end }}
{{- /* System message construction */ -}}
<|start_header_id|>system<|end_header_id>
{{- /* Environment and tools info */ -}}
{{ if $tools }}
Environment: ipython
Tools: {{ range $tools }}{{ if ne .Function.Name "code_interpreter" }}{{ .Function.Name }}, {{ end }}{{ end }}
{{ end }}
Cutting Knowledge Date: December 2023
Today Date: {{ $date_string }}
{{- /* Tools instructions if tools exist and not in user message */ -}}
{{ if and $tools (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.
{{ range $tools }}
{{ . | json 4 }}
{{ end }}
{{ end }}
{{ $system_message }}<|eot_id>
{{- /* Tools in user message logic */ -}}
{{ if and $tools_in_user_message $tools (gt (len $messages) 0) }}
{{ $first_user_message := (index $messages 0).Content }}
{{ $messages = slice $messages 1 }}
<|start_header_id|>user<|end_header_id>
Given the following functions, please respond with a JSON for a function call with its proper arguments that best answers the given prompt.
Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.
Do not use variables.
{{ range $tools }}
{{ . | json 4 }}
{{ end }}
{{ $first_user_message }}<|eot_id>
{{ end }}
{{- /* Iterate over remaining messages */ -}}
{{ range $messages }}
{{ if or (eq .Role "user") (eq .Role "assistant") }}
<|start_header_id|>{{ .Role }}<|end_header_id>
{{ .Content }}<|eot_id>
{{ else if or (eq .Role "ipython") (eq .Role "tool") }}
<|start_header_id|>ipython<|end_header_id>
{{ .Content | json }}<|eot_id>
{{ else if .ToolCalls }}
{{ $tool_call := index .ToolCalls 0 }}
<|start_header_id|>assistant<|end_header_id>
{"name": "{{ $tool_call.Function.Name }}", "parameters": {{ $tool_call.Function.Arguments | json }}}
<|eot_id>
{{ end }}
{{ end }}
{{- /* Add generation prompt */ -}}
<|start_header_id|>assistant<|end_header_id>