28 5 months ago

sarvam-m q8 24b with tool support

tools
084c74b6c977 · 2.3kB
{{- 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:**
- Question: "Hi, how are you?"
Answer: "Hi! I'm fine, thank you. How can I help?" (without tools).
- Question: "What is artificial intelligence?"
Answer: A brief definition based on your knowledge (without tools).
- Question: "What is the weather in Moscow?"
Action: Call a tool to get weather data.
**Important:** Frequent use of tools slows down the response and wastes resources. Strive for efficiency and call tools only when clearly necessary.
**Available tools:**
{{- range .Tools }}
Tool Name: {{ .Function.Name }}
Description: {{ .Function.Description }}
Parameters (JSON Schema): {{ .Function.Parameters }}
{{- end }}
**Tool call format (This is what YOU, the LLM, should generate textually if you decide to call a tool):**
<tool_call>
{"name": "tool_name", "parameters": {"param1": "value1", "param2": "value2"}}
</tool_call>
{{- end }}
<end_of_turn>
{{- end -}}
{{- /* This is where we iterate through the history of messages */ -}}
{{- range .Messages }}
{{- if eq .Role "user" }}
<start_of_turn>user
{{ .Content }}<end_of_turn>
{{- else if eq .Role "assistant" }}
<start_of_turn>model
{{- if .ToolCalls }}
{{- range .ToolCalls }}
<tool_call>
{"name": "{{ .Function.Name }}", "parameters": {{ .Function.Arguments }}}
</tool_call>
{{- end }}
{{- else }}
{{ .Content }}
{{- end }}
<end_of_turn>
{{- else if eq .Role "tool" }}
<start_of_turn>user
<tool_response>
{{- .Content }}
</tool_response><end_of_turn>
{{- end }}
{{- end -}}
{{- /* This is where the model starts its NEW response for the current turn */ -}}
<start_of_turn>model