From 993c8e434e87d05e715caed1d313e9ec06c4c574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=CE=94BL=C3=98=20=E1=84=83=CE=9E?= Date: Wed, 5 Jun 2024 23:09:51 -0500 Subject: [PATCH] add autocoder template --- src/llama_cpp_agent/messages_formatter.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/llama_cpp_agent/messages_formatter.py b/src/llama_cpp_agent/messages_formatter.py index 0f3fa43..6938de1 100644 --- a/src/llama_cpp_agent/messages_formatter.py +++ b/src/llama_cpp_agent/messages_formatter.py @@ -25,6 +25,7 @@ class MessagesFormatterType(Enum): LLAMA_3 = 12 PHI_3 = 13 OPEN_INTERPRETER = 14 + AUTOCODER = 15 @dataclass class PromptMarkers: @@ -223,6 +224,12 @@ def _format_response( Roles.assistant: PromptMarkers("### Response:\n", "\n"), Roles.tool: PromptMarkers("", ""), } +autocoder_chat_prompt_markers = { + Roles.system: PromptMarkers("", "\n"), + Roles.user: PromptMarkers("Human: ", "\n"), + Roles.assistant: PromptMarkers("Assistant: ", "<|EOT|>\n"), + Roles.tool: PromptMarkers("", ""), +} """ ### Instruction: @@ -336,6 +343,15 @@ def _format_response( use_user_role_for_function_call_result=True, ) +autocoder_chat_formatter = MessagesFormatter( + "", + autocoder_chat_prompt_markers, + True, + ["<|EOT|>"], + bos_token="<|begin▁of▁sentence|>", + eos_token="<|EOT|>", +) + predefined_formatter = { MessagesFormatterType.MISTRAL: mixtral_formatter, MessagesFormatterType.CHATML: chatml_formatter, @@ -351,6 +367,7 @@ def _format_response( MessagesFormatterType.LLAMA_3: llama_3_formatter, MessagesFormatterType.PHI_3: phi_3_chat_formatter, MessagesFormatterType.OPEN_INTERPRETER: open_interpreter_chat_formatter, + MessagesFormatterType.AUTOCODER: autocoder_chat_formatter, }