8000 vicuna · themrzmaster/llama-cpp-python@4341759 · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit 4341759

Browse files
committed
vicuna
1 parent 920dfba commit 4341759

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llama_cpp/llama_chat_format.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,6 +2532,7 @@ def base_function_calling(
25322532
text: llama_types.CreateCompletionResponse = message_output["choices"][0]["text"] # type: ignore
25332533
# fallback
25342534
if not text.startswith("functions."):
2535+
message_output["choices"][0]["text"] = message_output["choices"][0]["text"].replace("message:", "")
25352536
return _convert_completion_to_chat(message_output,stream=stream)
25362537

25372538
# One or more function calls
@@ -2819,7 +2820,7 @@ def vicuna_function_calling(
28192820
"\n\nYou have access to the following functions:\n"
28202821
"{% for tool in tools %}"
28212822
"\nfunctions.{{ tool.function.name }}:\n"
2822-
"{{ tool.function.arguments }}"
2823+
"{{ tool.function.parameters }}"
28232824
"\n{% endfor %}"
28242825
"\n\nYou can respond to users messages with either a single message or multiple function calls, never both. If function calls are used, they must be the first part of the response."
28252826
"\n\nTo respond with one or more function calls begin the message with 'functions.<function_name>:', use the following format:"
@@ -2854,7 +2855,7 @@ def vicuna_function_calling(
28542855
"{% if tool_calls %}"
28552856
"{% for tool_call in message.tool_calls %}"
28562857
"functions.{{ tool_call.function.name }}:\n"
2857-
"{{ (tool_call.arguments | default('{}') | tojson) }}"
2858+
"{{ (tool_call.function.parameters | default('{}') | tojson) }}"
28582859
"{% if not loop.last %};{% endif %}" # Semicolon separator if not the last function call
28592860
"{% endfor %}"
28602861
"</s>\n"

0 commit comments

Comments
 (0)
0