tiktoken_ruby 0.0.1-x86_64-linux → 0.0.2-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +9 -6
- data/lib/tiktoken_ruby/version.rb +1 -1
- data/lib/tiktoken_ruby.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f42a36a212c74827621edfe99357d60414c603a6ff27d25c073d1648e34a01a
|
4
|
+
data.tar.gz: 0f96d378802778af0ab256b111e46c6f8fb2bfe76da9adb249364602be40dbe6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9ec848fcbbcae810a018cab57c99323fee4a9062fa53c50ffdbbe7f5956a8aabebd92381dceb4ecfda79c7e38f51e6d031ab5e6cca2f13258073f9c24c119f8
|
7
|
+
data.tar.gz: 5b3d56a5ddbc56257081bf7481e36cde4c0f2da48f2433a6d42d11773c2491618d053ce1355fa28900c5f0530f2270c26eeee6961b5e6d243e634151707ed001
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/tiktoken_ruby.svg)](https://badge.fury.io/rb/tiktoken_ruby)
|
1
2
|
# tiktoken_ruby
|
2
3
|
|
3
4
|
[Tiktoken](https://github.com/openai/tiktoken) is BPE tokenizer from OpenAI used with their GPT models.
|
@@ -5,19 +6,21 @@ This is a wrapper around it aimed primarily at enabling accurate counts of GPT m
|
|
5
6
|
|
6
7
|
## Installation
|
7
8
|
|
8
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
9
|
-
|
10
9
|
Install the gem and add to the application's Gemfile by executing:
|
11
10
|
|
12
|
-
$ bundle add
|
11
|
+
$ bundle add tiktoken_ruby
|
13
12
|
|
14
13
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
15
14
|
|
16
|
-
$ gem install
|
15
|
+
$ gem install tiktoken_ruby
|
17
16
|
|
18
17
|
## Usage
|
19
18
|
|
20
|
-
|
19
|
+
```ruby
|
20
|
+
encoding = Tiktoken::Encoding.r50k_base
|
21
|
+
tokens = encoding.encode("Hello world!")
|
22
|
+
puts encoding.decode(tokens)
|
23
|
+
```
|
21
24
|
|
22
25
|
## Development
|
23
26
|
|
@@ -27,7 +30,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
27
30
|
|
28
31
|
## Contributing
|
29
32
|
|
30
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/iapark/tiktoken_ruby.
|
31
34
|
|
32
35
|
## License
|
33
36
|
|
data/lib/tiktoken_ruby.rb
CHANGED
@@ -2,7 +2,13 @@
|
|
2
2
|
|
3
3
|
require_relative "tiktoken_ruby/version"
|
4
4
|
require_relative "tiktoken_ruby/encoding.rb"
|
5
|
-
|
5
|
+
|
6
|
+
begin
|
7
|
+
RUBY_VERSION =~ /(\d+\.\d+)/
|
8
|
+
require_relative "tiktoken_ruby/#{$1}/tiktoken_ruby"
|
9
|
+
rescue LoadError
|
10
|
+
require_relative "tiktoken_ruby/tiktoken_ruby"
|
11
|
+
end
|
6
12
|
|
7
13
|
module Tiktoken
|
8
14
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiktoken_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- IAPark
|
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
requirements:
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 3.
|
57
|
+
version: 3.1.0
|
58
58
|
requirements: []
|
59
59
|
rubygems_version: 3.4.4
|
60
60
|
signing_key:
|