Skip to content

Commit 40b1eb8

Browse files
authored
Merge pull request #73 from woheller69/patch-1
Fix GEMMA_2, LLAMA_3, and PHI_3 MessagesFormatter
2 parents 233fe1d + dd2fe1a commit 40b1eb8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/llama_cpp_agent/messages_formatter.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def _format_response(
161161
llama_3_prompt_markers = {
162162
Roles.system: PromptMarkers("""<|start_header_id|>system<|end_header_id|>\n""", """<|eot_id|>"""),
163163
Roles.user: PromptMarkers("""<|start_header_id|>user<|end_header_id|>\n""", """<|eot_id|>"""),
164-
Roles.assistant: PromptMarkers("""<|start_header_id|>assistant<|end_header_id|>\n""", """<|eot_id|>"""),
164+
Roles.assistant: PromptMarkers("""<|start_header_id|>assistant<|end_header_id|>\n\n""", """<|eot_id|>"""),
165165
Roles.tool: PromptMarkers("""<|start_header_id|>function_calling_results<|end_header_id|>\n""", """<|eot_id|>"""),
166166
}
167167

@@ -181,7 +181,7 @@ def _format_response(
181181
gemma_2_prompt_markers = {
182182
Roles.system: PromptMarkers("""""", """\n\n"""),
183183
Roles.user: PromptMarkers("""<start_of_turn>user\n""", """<end_of_turn>\n"""),
184-
Roles.assistant: PromptMarkers("""<start_of_turn>model\n""", """<end_of_turn>\n"""),
184+
Roles.assistant: PromptMarkers("""<start_of_turn>model\n\n""", """<end_of_turn>\n"""),
185185
Roles.tool: PromptMarkers("", ""),
186186
}
187187
code_ds_prompt_markers = {
@@ -344,7 +344,7 @@ def _format_response(
344344
"",
345345
phi_3_chat_prompt_markers,
346346
True,
347-
["<|end|>", "<|end_of_turn|>"],
347+
["<|end|>", "<|endoftext|>"],
348348
use_user_role_for_function_call_result=True,
349349
)
350350

0 commit comments

Comments
 (0)