From 43f49533e829e0d16a8bbb56eccad28616a4705f Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Thu, 25 Jul 2024 19:37:35 +0200 Subject: [PATCH] chore: add function calling template for llama 3.1 models (#3010) Signed-off-by: Ettore Di Giacinto --- gallery/index.yaml | 2 +- gallery/llama3.1-instruct.yaml | 62 ++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 gallery/llama3.1-instruct.yaml diff --git a/gallery/index.yaml b/gallery/index.yaml index c8b361c3..3648c2d8 100644 --- a/gallery/index.yaml +++ b/gallery/index.yaml @@ -1,7 +1,7 @@ --- ## LLama3.1 - &llama31 - url: "github:mudler/LocalAI/gallery/llama3-instruct.yaml@master" + url: "github:mudler/LocalAI/gallery/llama3.1-instruct.yaml@master" icon: https://cdn-uploads.huggingface.co/production/uploads/642cc1c253e76b4c2286c58e/aJJxKus1wP5N-euvHEUq7.png name: "meta-llama-3.1-8b-instruct" license: llama3.1 diff --git a/gallery/llama3.1-instruct.yaml b/gallery/llama3.1-instruct.yaml new file mode 100644 index 00000000..66c9ce97 --- /dev/null +++ b/gallery/llama3.1-instruct.yaml @@ -0,0 +1,62 @@ +--- +name: "llama3-instruct" + +config_file: | + mmap: true + function: + disable_no_action: true + grammar: + disable: true + response_regex: + - \w+)>(?P.*) + template: + chat_message: | + <|start_header_id|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}}<|end_header_id|> + + {{ if .FunctionCall -}} + Function call: + {{ else if eq .RoleName "tool" -}} + Function response: + {{ end -}} + {{ if .Content -}} + {{.Content -}} + {{ else if .FunctionCall -}} + {{ toJson .FunctionCall -}} + {{ end -}} + <|eot_id|> + function: | + <|start_header_id|>system<|end_header_id|> + + You have access to the following functions: + + {{range .Functions}} + Use the function '{{.Name}}' to '{{.Description}}' + {{toJson .Parameters}} + {{end}} + + Think very carefully before calling functions. + If a you choose to call a function ONLY reply in the following format with no prefix or suffix: + + {{`{{"example_name": "example_value"}}`}} + + Reminder: + - If looking for real time information use relevant functions before falling back to searching on internet + - Function calls MUST follow the specified format, start with + - Required parameters MUST be specified + - Only call one function at a time + - Put the entire function call reply on one line + <|eot_id|> + {{.Input }} + <|start_header_id|>assistant<|end_header_id|> + chat: | + <|begin_of_text|>{{.Input }} + <|start_header_id|>assistant<|end_header_id|> + completion: | + {{.Input}} + context_size: 8192 + f16: true + stopwords: + - <|im_end|> + - + - "<|eot_id|>" + - <|end_of_text|>