8000 fix: minor formatting bugs for chatml-function-calling · coderonion/llama-cpp-python@4b0e332 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4b0e332

Browse files
committed
fix: minor formatting bugs for chatml-function-calling
1 parent 6fe8b42 commit 4b0e332

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llama_cpp/llama_chat_format.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2072,12 +2072,14 @@ def chatml_function_calling(
20722072
"{% if message.role == 'assistant' %}"
20732073
## Reglar message
20742074
"{% if message.content and message.content | length > 0 %}"
2075+
"{% if tool_calls %}"
20752076
"message:\n"
2077+
"{% endif %}"
20762078
"{{ message.content }}"
20772079
"\n<|im_end|>\n"
20782080
"{% endif %}"
20792081
## Function calls
2080-
"{% if message.tool_calls %}"
2082+
"{% if 'tool_calls' in message %}"
20812083
"{% for tool_call in message.tool_calls %}"
20822084
"functions.{{ tool_call.function.name }}:\n"
20832085
"{{ tool_call.function.arguments }}"

0 commit comments

Comments
 (0)
0