Skip to content

Commit d959b8f

Browse files
committed
Set tiktoken-c version to 0.10.0
1 parent dc8e0f6 commit d959b8f

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ default = []
1818
logging = ["log", "simple_logger"]
1919

2020
[dependencies]
21-
tiktoken-rs = "0.9"
21+
tiktoken-rs = "0.10.0"
2222
log = { version = "0.4", optional = true }
2323
simple_logger = { version = "5.0", optional = true }
2424
libc = "0.2"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/kojix2/tiktoken-c)
66

77
- C API for [Tiktoken](https://github.com/openai/tiktoken), OpenAI's tokenizer
8-
- Compatible with [tiktoken-rs](https://github.com/zurawiki/tiktoken-rs) 0.9.1
8+
- Compatible with [tiktoken-rs](https://github.com/zurawiki/tiktoken-rs) 0.10.0
99

1010
## Installation
1111

src/corebpe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ pub extern "C" fn tiktoken_get_bpe_from_model(model: *const c_char) -> *mut Core
8383
}
8484
}
8585
};
86-
let bpe = tiktoken_rs::get_bpe_from_model(model);
86+
let bpe = tiktoken_rs::bpe_for_model(model);
8787
match bpe {
8888
Ok(bpe) => {
89-
let boxed = Box::new(bpe);
89+
let boxed = Box::new(bpe.clone());
9090
Box::into_raw(boxed)
9191
}
9292
Err(_) => {

src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub extern "C" fn tiktoken_get_completion_max_tokens(
6161
}
6262
}
6363
};
64-
match tiktoken_rs::get_completion_max_tokens(model, prompt) {
64+
match tiktoken_rs::get_text_completion_max_tokens(model, prompt) {
6565
Ok(max_tokens) => max_tokens,
6666
Err(_) => {
6767
#[cfg(feature = "logging")]
@@ -162,6 +162,8 @@ pub extern "C" fn tiktoken_num_tokens_from_messages(
162162
content: content,
163163
name: name,
164164
function_call: function_call,
165+
tool_calls: Vec::new(),
166+
refusal: None,
165167
});
166168
}
167169
messages_vec
@@ -258,6 +260,8 @@ pub extern "C" fn tiktoken_get_chat_completion_max_tokens(
258260
content: content,
259261
name: name,
260262
function_call: function_call,
263+
tool_calls: Vec::new(),
264+
refusal: None,
261265
});
262266
}
263267
messages_vec
@@ -425,7 +429,6 @@ pub extern "C" fn tiktoken_corebpe_decode(
425429
return std::ptr::null_mut();
426430
}
427431
let tokens = unsafe { std::slice::from_raw_parts(tokens, num_tokens) };
428-
let tokens = tokens.to_vec();
429432

430433
let corebpe = unsafe { &mut *ptr };
431434
let decoded = corebpe.decode(tokens);

0 commit comments

Comments
 (0)