141 8 months ago

O melhor modelo para chatbot. Gemma3 12b quantizado, otimizado para Português Brasileiro, com chamada de tools e vision. Funciona muito bem em uma RTX3060 de 12gb.

tools thinking
2adabc614d50 · 2.5kB
{{- $lastUserIdx := -1 -}}
{{- range $idx, $msg := .Messages -}}
{{- if eq $msg.Role "user" }}{{ $lastUserIdx = $idx }}{{ end -}}
{{- end }}
{{- if or .System .Tools }}<|im_start|>system
{{ if .System }}
{{ .System }}
{{ else }}
Você deve se comunicar, pensar e responder sempre em português do Brasil, salvo indicação contrária do usuário.
IMPORTANTE: Quando você usar o thinking (entre as tags <think></think>), você deve pensar exclusivamente em português brasileiro. Seus pensamentos internos devem ser em português, incluindo:
- Análise do problema
- Planejamento da resposta
- Raciocínio lógico
- Considerações e reflexões
- Qualquer processo mental interno
Exemplo de thinking adequado:
<think>
Preciso analisar esta questão cuidadosamente. O usuário está perguntando sobre X, então vou considerar os seguintes pontos:
1. Primeiro aspecto a considerar...
2. Segundo ponto importante...
Baseado nisso, a melhor abordagem seria...
</think>
{{ end }}
{{- if .Tools }}
Você pode chamar uma ou mais funções para ajudar na solicitação do usuário.
As assinaturas das funções são fornecidas dentro das tags XML <tools></tools>:
<tools>
{{- range .Tools }}
{"type": "function", "function": {{ .Function }}}
{{- end }}
</tools>
Para cada chamada de função, retorne um objeto JSON com o nome da função e os argumentos dentro das tags XML <tool_call></tool_call>:
<tool_call>
{"name": <nome-da-função>, "arguments": <objeto-json-com-argumentos>}
</tool_call>
{{- end -}}
<|im_end|>
{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if eq .Role "user" }}<|im_start|>user
{{ .Content }}
{{- if and $.IsThinkSet (eq $i $lastUserIdx) }}
{{- if $.Think -}}
{{- " "}}/think
{{- else -}}
{{- " "}}/no_think
{{- end -}}
{{- end }}<|im_end|>
{{ else if eq .Role "assistant" }}<|im_start|>assistant
{{ if (and $.IsThinkSet (and .Thinking (or $last (gt $i $lastUserIdx)))) -}}
<think>{{ .Thinking }}</think>
{{ end -}}
{{ if .Content }}{{ .Content }}
{{- else if .ToolCalls }}<tool_call>
{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{ end }}</tool_call>
{{- end }}{{ if not $last }}<|im_end|>
{{ end }}
{{- else if eq .Role "tool" }}<|im_start|>user
<tool_response>
{{ .Content }}
</tool_response><|im_end|>
{{ end }}
{{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
{{ if and $.IsThinkSet (not $.Think) -}}
<think>
</think>
{{ end -}}
{{ end }}
{{- end }}