Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7ddf097

Browse filesBrowse files
committed
correct llama_chat_apply_template function params
1 parent 84bcb2c commit 7ddf097
Copy full SHA for 7ddf097

File tree

Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed

‎llama_cpp/llama_cpp.py

Copy file name to clipboardExpand all lines: llama_cpp/llama_cpp.py
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,19 +2942,17 @@ def llama_detokenize(
29422942
# // Chat templates
29432943
# //
29442944

2945-
29462945
# /// Apply chat template. Inspired by hf apply_chat_template() on python.
29472946
# /// Both "model" and "custom_template" are optional, but at least one is required. "custom_template" has higher precedence than "model"
29482947
# /// NOTE: This function does not use a jinja parser. It only support a pre-defined list of template. See more: https://github.com/ggerganov/llama.cpp/wiki/Templates-supported-by-llama_chat_apply_template
2949-
# /// @param tmpl A Jinja template to use for this chat. If this is nullptr, the models default chat template will be used instead.
2948+
# /// @param tmpl A Jinja template to use for this chat. If this is nullptr, the model's default chat template will be used instead.
29502949
# /// @param chat Pointer to a list of multiple llama_chat_message
29512950
# /// @param n_msg Number of llama_chat_message in this chat
29522951
# /// @param add_ass Whether to end the prompt with the token(s) that indicate the start of an assistant message.
29532952
# /// @param buf A buffer to hold the output formatted prompt. The recommended alloc size is 2 * (total number of characters of all messages)
29542953
# /// @param length The size of the allocated buffer
29552954
# /// @return The total number of bytes of the formatted prompt. If is it larger than the size of buffer, you may need to re-alloc it and then re-apply the template.
29562955
# LLAMA_API int32_t llama_chat_apply_template(
2957-
# const struct llama_model * model,
29582956
# const char * tmpl,
29592957
# const struct llama_chat_message * chat,
29602958
# size_t n_msg,
@@ -2964,18 +2962,22 @@ def llama_detokenize(
29642962
@ctypes_function(
29652963
"llama_chat_apply_template",
29662964
[
2967-
ctypes.c_void_p,
29682965
ctypes.c_char_p,
29692966
ctypes.POINTER(llama_chat_message),
29702967
ctypes.c_size_t,
2968+
bool,
2969+
ctypes.c_char_p,
2970+
ctypes.c_int32
29712971
],
29722972
ctypes.c_int32,
29732973
)
29742974
def llama_chat_apply_template(
2975-
model: llama_model_p,
29762975
tmpl: bytes,
29772976
chat: CtypesArray[llama_chat_message],
29782977
n_msg: int,
2978+
add_ass: bool,
2979+
buf: bytes,
2980+
length: int,
29792981
/,
29802982
) -> int:
29812983
...

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.