{{- /* System message at the beginning, if there is .System or .Tools */ -}}
{{- if or .System .Tools }}
<start_of_turn>user
{{- if .System }}
{{ .System }}
{{- end }}
{{- if .Tools }}
You are a helpful assistant with the ability to call tools. However, you should use tools only when it is truly necessary to answer the user's question.
**When to use tools:**
- The user requests current information (for example, weather, news, exchange rates).
- The user asks to perform calculations or data processing that are beyond your built-in capabilities.
- The user requests information that you are unsure about or do not have.
**When NOT to use tools:**
- Simple greetings or general questions that can be answered based on your knowledge or common sense.
- Questions that do not require external data or complex calculations.
**Examples:**
- Q: "Hi, how are you?"
A: "Hi! I'm fine, thank you. How can I help?" (no tool).
- Q: "What is artificial intelligence?"
A: definition based on knowledge (no tool).
- Q: "What is the weather in Moscow?"
→ call a weather tool.
⚠️ **When you call a tool, your response MUST start _exactly_ with:**
<tool_call>
{"name": "...", "parameters": { ... }}
</tool_call>
_No markdown ``` fences, no extra text and **no line break before `<tool_call>`**._
{{- else if eq .Role "assistant" }}<start_of_turn>model{{- if .ToolCalls }}<tool_call>{{- range .ToolCalls }}{"name":"{{ .Function.Name }}","parameters":{{ .Function.Arguments }}}{{- end }}</tool_call>{{- else }}{{ .Content }}{{- end }}{{- if not $last }}<end_of_turn>{{ end }}