File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -2088,6 +2088,7 @@ def chatml_function_calling(
2088
2088
"{% endif %}"
2089
2089
"{% endif %}"
2090
2090
"{% endfor %}"
2091
+ "{% if add_generation_prompt %}{{ '<|im_start|>assistant\n ' }}{%
8000
endif %}"
2091
2092
)
2092
2093
template_renderer = jinja2 .Environment (
2093
2094
loader = jinja2 .BaseLoader (),
@@ -2130,6 +2131,7 @@ def chatml_function_calling(
2130
2131
messages = messages ,
2131
2132
tools = [],
2132
2133
tool_calls = None ,
2134
+ add_generation_prompt = True ,
2133
2135
)
2134
2136
if response_format is not None and response_format ["type" ] == "json_object" :
2135
2137
try :
@@ -2363,6 +2365,7 @@ def _stream_response_to_function_stream(
2363
2365
messages = messages ,
2364
2366
tools = tools ,
2365
2367
tool_calls = True ,
2368
+ add_generation_prompt = True ,
2366
2369
)
2367
2370
prompt += f"functions.{ tool_name } :\n "
2368
2371
try :
@@ -2420,6 +2423,7 @@ def _stream_response_to_function_stream(
2420
2423
messages = messages ,
2421
2424
tools = tools ,
2422
2425
tool_calls = True ,
2426
+ add_generation_prompt = True ,
2423
2427
)
2424
2428
completion_or_chunks = llama .create_completion (
2425
2429
prompt = prompt ,
You can’t perform that action at this time.
0 commit comments