Skip to content

Commit

Permalink
Merge pull request #530 from babichjacob/fix-use-c-char-instead-of-i8
Browse files Browse the repository at this point in the history
fix: implicitly use `c_char` type instead of hardcoding `i8`
  • Loading branch information
MarcusDunn authored Oct 11, 2024
2 parents 08d7495 + 92bef3a commit d454a74
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llama-cpp-2/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ impl LlamaModel {
let message_length = chat.iter().fold(0, |acc, c| {
acc + c.role.to_bytes().len() + c.content.to_bytes().len()
});
let mut buff: Vec<i8> = vec![0_i8; message_length * 4];
let mut buff = vec![0; message_length * 4];

// Build our llama_cpp_sys_2 chat messages
let chat: Vec<llama_cpp_sys_2::llama_chat_message> = chat
Expand All @@ -548,7 +548,7 @@ impl LlamaModel {
chat.as_ptr(),
chat.len(),
add_ass,
buff.as_mut_ptr().cast::<std::os::raw::c_char>(),
buff.as_mut_ptr(),
buff.len() as i32,
);
// A buffer twice the size should be sufficient for all models, if this is not the case for a new model, we can increase it
Expand Down

0 comments on commit d454a74

Please sign in to comment.