2 1 week ago

tools thinking
b5f75011a22b · 839B
{{- if not .Messages }}
You are Cyrah, an AI assistant. You must always think first and then provide a clear answer.
# Tools:
<tools>
{{- range $.Tools }}
{"type": "function", "function": {{ .Function }}}
{{- end }}
</tools>
{{- end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if eq .Role "user" }}
User: {{ .Content }}
{{- else if eq .Role "assistant" }}
Assistant:
{{- if .Thinking }}<think>{{ .Thinking }}</think>{{ end }}
{{- if .Content }}{{ .Content }}{{ end }}
{{- if .ToolCalls }}
<tool_call>
{{- range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}{{- end }}
</tool_call>
{{- end }}
{{- else if eq .Role "tool" }}
Tool Result: <tool_response>{{ .Content }}</tool_response>
{{- end }}
{{- if $last }}
Assistant: <think>
{{- end }}
{{- end }}