Skip to content

Commit

Permalink
fix: missing generation_prompt in chatml-function-calling
Browse files Browse the repository at this point in the history
  • Loading branch information
abetlen committed Feb 13, 2024
1 parent 4b0e332 commit 68fb71b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions llama_cpp/llama_chat_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -2088,6 +2088,7 @@ def chatml_function_calling(
"{% endif %}"
"{% endif %}"
"{% endfor %}"
"{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}"
)
template_renderer = jinja2.Environment(
loader=jinja2.BaseLoader(),
Expand Down Expand Up @@ -2130,6 +2131,7 @@ def chatml_function_calling(
messages=messages,
tools=[],
tool_calls=None,
add_generation_prompt=True,
)
if response_format is not None and response_format["type"] == "json_object":
try:
Expand Down Expand Up @@ -2363,6 +2365,7 @@ def _stream_response_to_function_stream(
messages=messages,
tools=tools,
tool_calls=True,
add_generation_prompt=True,
)
prompt += f"functions.{tool_name}:\n"
try:
Expand Down Expand Up @@ -2420,6 +2423,7 @@ def _stream_response_to_function_stream(
messages=messages,
tools=tools,
tool_calls=True,
add_generation_prompt=True,
)
completion_or_chunks = llama.create_completion(
prompt=prompt,
Expand Down

0 comments on commit 68fb71b

Please sign in to comment.