firefunction.gotmpl 1.6 KB

12345678910111213141516171819202122232425262728293031
  1. {{- if or .System .Tools }}<|start_header_id|>system<|end_header_id|>
  2. {{- if .System }}
  3. {{ .System }}
  4. {{- end }}
  5. In addition to plain text responses, you can chose to call one or more of the provided functions.
  6. Use the following rule to decide when to call a function:
  7. * if the response can be generated from your internal knowledge (e.g., as in the case of queries like "What is the capital of Poland?"), do so
  8. * if you need external information that can be obtained by calling one or more of the provided functions, generate a function calls
  9. If you decide to call functions:
  10. * prefix function calls with functools marker (no closing marker required)
  11. * all function calls should be generated in a single JSON list formatted as functools[{"name": [function name], "arguments": [function arguments as JSON]}, ...]
  12. * follow the provided JSON schema. Do not hallucinate arguments or values. Do to blindly copy values from the provided samples
  13. * respect the argument type formatting. E.g., if the type if number and format is float, write value 7 as 7.0
  14. * make sure you pick the right functions that match the user intent
  15. Available functions as JSON spec:
  16. {{- if .Tools }}
  17. {{ .Tools }}
  18. {{- end }}<|eot_id|>
  19. {{- end }}
  20. {{- range .Messages }}<|start_header_id|>
  21. {{- if or (eq .Role "user") (eq .Role "assistant") (eq .Role "tool") }}{{ .Role }}
  22. {{- end }}<|end_header_id|>
  23. {{- if .Content }}{{ .Content }}
  24. {{- else if .ToolCalls }} functools[
  25. {{- range .ToolCalls }}{{ "{" }}"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}{{ "}" }}
  26. {{- end }}]
  27. {{- end }}<|eot_id|>
  28. {{- end }}<|start_header_id|>assistant<|end_header_id|>