109 1 month ago

Sarvam-1

tools
52e45bd5dce2 · 1.1kB
{{- /* Handle system message if present */ -}}
{{- if .System -}}
{{- if eq (len .Messages) 0 -}}
[INST] <<SYS>>{{ .System }}<</SYS>> [/INST]
{{- end -}}
{{- end -}}
{{- /* Process conversation messages */ -}}
{{- range $index, $message := .Messages -}}
{{- if eq .Role "user" -}}
{{- if and $.System (eq $index 0) -}}
[INST] <<SYS>>{{ $.System }}<</SYS>> {{ .Content }} [/INST]
{{- else -}}
[INST] {{ .Content }} [/INST]
{{- end -}}
{{- else if eq .Role "assistant" -}}
{{ .Content }} </s>
{{- else if eq .Role "tool" -}}
[TOOL_CALLS] {{ .Content }} [/TOOL_CALLS]
{{- end -}}
{{- end -}}
{{- /* Add tools information if available */ -}}
{{- if .Tools -}}
{{- if eq (len .Messages) 0 -}}
[INST]
**Available tools:**
{{- range .Tools }}
Tool Name: {{ .Function.Name }}
Description: {{ .Function.Description }}
Parameters: {{ .Function.Parameters }}
{{- end }}
**Tool call format:**
<tool_call>
{"name": "tool_name", "parameters": {"param1": "value1", "param2": "value2"}}
</tool_call>
[/INST]
{{- end -}}
{{- end -}}