ru_token 0.1.19 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +15 -7
- data/lib/ru_token/version.rb +1 -1
- data/ru_token.gemspec +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cc9ba69b791741a09196a9f0f6c33bc1a0302862612a57da8ec4b333c53436b
|
4
|
+
data.tar.gz: 5b80490dea17cf9c1dcbb2a1c7e0bbe355abd020d0d75361bc07ffb6d0bd08bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53cfb2906f1d4368653d6409277ffd9ce716a502ecd3b65b1de7dd0e9aab5034f8bd5a78bf6ebc1a953bdb0d88c806cf73ceb76de54774dd6e6bf372e15d5dc5
|
7
|
+
data.tar.gz: e2bb7d5f51a9febee1d3bdb5345cfd723ebf78edb04e2015d07e4e5051b3ecff4f6b7d172dedd1fd836f5f551e2b7a759eb25662809b2c2c816ae32723a46cda
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
---
|
11
|
+
## [0.1.20] - 2025-07-31
|
12
|
+
### Change
|
13
|
+
- Remove x64-mingw32 from Gemfile.lock
|
14
|
+
- Update README
|
15
|
+
|
10
16
|
---
|
11
17
|
## [0.1.19] - 2025-07-31
|
12
18
|
### No Change
|
data/README.md
CHANGED
@@ -1,16 +1,24 @@
|
|
1
|
-
# RuToken 🦕
|
1
|
+
# RuToken [🦕](https://youtu.be/0MX31NTNrho?si=NgLE4-UL3zgiUVd7)
|
2
|
+
|
2
3
|
RuToken provides a high-performance, native Ruby interface for counting tokens using the powerful [tiktoken-rs](https://github.com/zurawiki/tiktoken-rs) library. It leverages the speed of Rust to offer a fast and efficient way to calculate token counts for various OpenAI models.
|
3
4
|
|
4
5
|
The gem ships with pre-compiled native extensions for Linux and macOS, so your end-users don't need a Rust toolchain installed.
|
5
6
|
|
6
7
|
Supports Ruby >= 2.7.0
|
7
8
|
|
8
|
-
|
9
|
-
High Performance ⚡️: Uses a native Rust implementation for blazing-fast tokenization.
|
9
|
+
Extensive Model Support: Includes tokenizers for all modern and legacy OpenAI models, recognizing dozens of model aliases automatically.
|
10
10
|
|
11
|
-
|
11
|
+
[https://rubygems.org/gems/ru_token](https://rubygems.org/gems/ru_token)
|
12
12
|
|
13
|
-
|
13
|
+
## Install
|
14
|
+
|
15
|
+
#### Gemfile
|
16
|
+
`gem 'ru_token', '~> 0.1.20'`
|
17
|
+
|
18
|
+
#### Command Line
|
19
|
+
`gem install ru_token -v '~> 0.1.20'`
|
20
|
+
|
21
|
+
## Use
|
14
22
|
|
15
23
|
### Count tokens for a specific model (the model keyword is required)
|
16
24
|
```Ruby
|
@@ -19,7 +27,7 @@ count = RuToken::Tokenizer.count("hello world!", model: "gpt-4.1")
|
|
19
27
|
|
20
28
|
### The gem recognizes many aliases, including older models
|
21
29
|
```Ruby
|
22
|
-
count = RuToken::Tokenizer.count(
|
30
|
+
count = RuToken::Tokenizer.count("hello world!", model: "text-davinci-003")
|
23
31
|
```
|
24
32
|
|
25
33
|
### The count method calls .to_s on the argument if it is not a string
|
@@ -57,7 +65,7 @@ Specs:
|
|
57
65
|
Both:
|
58
66
|
`bundle exec rake`
|
59
67
|
|
60
|
-
|
68
|
+
Interactive console for experimentation: `bin/console`
|
61
69
|
|
62
70
|
## Contributing
|
63
71
|
|
data/lib/ru_token/version.rb
CHANGED
data/ru_token.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["loganbbres@gmail.com"]
|
10
10
|
|
11
11
|
spec.summary = "Ruby wrapper for the tiktoken Rust library, providing fast tokenization for OpenAI models."
|
12
|
-
spec.description = "RuToken is a Ruby gem that wraps the tiktoken Rust library, enabling fast and efficient tokenization for OpenAI models. It supports multiple models including o200k_base, cl100k_base, p50k_base, and r50k_base."
|
12
|
+
spec.description = "[DEPRECATED] The 'ru_token' gem is deprecated and will no longer be maintained. Please switch to 'j_r_r_token'. RuToken is a Ruby gem that wraps the tiktoken Rust library, enabling fast and efficient tokenization for OpenAI models. It supports multiple models including o200k_base, cl100k_base, p50k_base, and r50k_base."
|
13
13
|
spec.homepage = "https://github.com/LoganBresnahan/ru_token"
|
14
14
|
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = ">= 2.7.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ru_token
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logan Bresnahan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,9 +52,10 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description:
|
56
|
-
|
57
|
-
|
55
|
+
description: "[DEPRECATED] The 'ru_token' gem is deprecated and will no longer be
|
56
|
+
maintained. Please switch to 'j_r_r_token'. RuToken is a Ruby gem that wraps the
|
57
|
+
tiktoken Rust library, enabling fast and efficient tokenization for OpenAI models.
|
58
|
+
It supports multiple models including o200k_base, cl100k_base, p50k_base, and r50k_base."
|
58
59
|
email:
|
59
60
|
- loganbbres@gmail.com
|
60
61
|
executables: []
|
@@ -99,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
100
|
- !ruby/object:Gem::Version
|
100
101
|
version: 3.0.0
|
101
102
|
requirements: []
|
102
|
-
rubygems_version: 3.
|
103
|
+
rubygems_version: 3.4.10
|
103
104
|
signing_key:
|
104
105
|
specification_version: 4
|
105
106
|
summary: Ruby wrapper for the tiktoken Rust library, providing fast tokenization for
|