llama3-groq-tool-use.gotmpl 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {{- if .Messages }}
  2. {{- if or .System .Tools }}<|start_header_id|>system<|end_header_id|>
  3. {{ .System }}
  4. {{- if .Tools }} You are provided with function signatures within <tools></tools> XML tags. You may call one or more functions to assist with the user query. Don't make assumptions about what values to plug into functions. For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows:
  5. <tool_call>
  6. {"name": <function-name>,"arguments": <args-dict>}
  7. </tool_call>
  8. Here are the available tools:
  9. <tools>
  10. {{- range .Tools }} {{ .Function }}
  11. {{- end }} </tools>
  12. {{- end }}
  13. {{- end }}<|eot_id|>
  14. {{- range .Messages }}
  15. {{- if ne .Role "system" }}<|start_header_id|>{{ .Role }}<|end_header_id|>
  16. {{ if eq .Role "user" }}{{ .Content }}
  17. {{- else if eq .Role "assistant" }}
  18. {{- if .Content }}{{ .Content }}
  19. {{- else if .ToolCalls }}<tool_call>
  20. {{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
  21. {{- end }}
  22. </tool_call>
  23. {{- end }}
  24. {{- else if eq .Role "tool" }}<tool_response>
  25. {{ .Content }}
  26. </tool_response>
  27. {{- end }}<|eot_id|>
  28. {{- end }}
  29. {{- end }}<|start_header_id|>assistant<|end_header_id|>
  30. {{ else }}
  31. {{ if .System }}<|start_header_id|>system<|end_header_id|>
  32. {{ .System }}<|eot_id|>{{ end }}{{ if .Prompt }}<|start_header_id|>user<|end_header_id|>
  33. {{ .Prompt }}<|eot_id|>{{ end }}<|start_header_id|>assistant<|end_header_id|>
  34. {{ end }}{{ .Response }}
  35. {{- if .Response }}<|eot_id|>
  36. {{- end }}