Skip to content

Commit 8bf0f44

Browse files
committed
improve gguf-function-calling parser
1 parent 640e59f commit 8bf0f44

File tree

2 files changed

+385
-2
lines changed

2 files changed

+385
-2
lines changed

llama_cpp/llama_chat_format.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4363,7 +4363,7 @@ def gguf_function_calling(
43634363
prompt += "<function_calls>\n"
43644364
if stream:
43654365
return _stream_tool_calls(
4366-
llama, prompt, tools, tool_name, completion_kwargs, follow_up_gbnf_tool_grammar
4366+
llama, prompt, tools, tool_name, completion_kwargs, follow_up_gbnf_tool_grammar, message_content
43674367
)
43684368
tool = next((tool for tool in tools if tool["function"]["name"] == tool_name), None)
43694369
completions: List[llama_types.CreateCompletionResponse] = []
@@ -4431,7 +4431,7 @@ def gguf_function_calling(
44314431
),
44324432
"message": {
44334433
"role": "assistant",
4434-
"content": None,
4434+
"content": message_content, # Include message content if present
44354435
"tool_calls": [
44364436
{
44374437
"id": "call_" + f"_{i}_" + tool_name + "_" + completion["id"],

0 commit comments

Comments
 (0)