File size: 2,797 Bytes
4b01eec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
FROM ./Ze1.5-1.5B-Automotive-Embedded-Instruct-F16.gguf
# Tool-aware ChatML template. Two reasons it must reference .Tools:
#   1) Ollama sets the model's "tools" capability ONLY if the template has a .Tools node — that's
#      what makes GitHub Copilot (and other clients) show Tools / agent mode for this model.
#   2) When a client passes tools, they're rendered into the system `# Tools` block in the exact
#      format this model expects.
# NOTE: this model emits tool calls as a ```json code block (not a special tool-call token), so the
# tool instruction AND the assistant .ToolCalls rendering use a ```json fence, and tool results
# come back as <tool_response> in a user turn.
TEMPLATE """{{- if .Messages }}
{{- if or .System .Tools }}<|im_start|>system
{{- if .System }}
{{ .System }}
{{- end }}
{{- if .Tools }}

# Tools

You may call one or more functions to assist with the user query.

You are provided with function signatures within <tools></tools> XML tags:
<tools>
{{- range .Tools }}
{"type": "function", "function": {{ .Function }}}
{{- end }}
</tools>

To call a function, output a ```json code block containing a JSON object with the function name and arguments, then stop:
```json
{"name": <function-name>, "arguments": <args-json-object>}
```
{{- end }}<|im_end|>
{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if eq .Role "user" }}<|im_start|>user
{{ .Content }}<|im_end|>
{{ else if eq .Role "assistant" }}<|im_start|>assistant
{{ if .Content }}{{ .Content }}
{{- else if .ToolCalls }}```json
{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{ end }}```
{{- 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
{{ end }}
{{- end }}
{{- else }}
{{- if .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{ end }}{{ if .Prompt }}<|im_start|>user
{{ .Prompt }}<|im_end|>
{{ end }}<|im_start|>assistant
{{ end }}{{ .Response }}"""
SYSTEM """You are Ze1.5, an embedded-systems and automotive firmware specialist: C/C++, MCUs, RTOS, drivers/peripherals (UART/SPI/I2C/CAN/LIN/Ethernet), ISRs, UDS/OBD diagnostics, MISRA C, and AUTOSAR (Classic and Adaptive Platform). Answer precisely and, when a tool is provided and useful, call it."""
PARAMETER temperature 0.7
PARAMETER top_p 0.8
PARAMETER top_k 20
PARAMETER repeat_penalty 1.1
# Copilot/agent clients send large prompts (system + tool defs + file context). Default num_ctx
# 4096 truncates those; 16384 fits a typical agent turn on 8 GB (weights ~3GB + KV ~0.5GB).
PARAMETER num_ctx 16384
PARAMETER stop "<|im_end|>"
PARAMETER stop "<|im_start|>"