tiktoken_ruby 0.0.1-x86_64-darwin → 0.0.2-x86_64-darwin

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cf0c29121975d236c0de69068495c42f32b48402717b677fc03bb58cae0e87d
4
- data.tar.gz: b3ad5ed52de98d86bf97c5b52e4c6e994a128ae479591c437c8cd82085b7e53e
3
+ metadata.gz: bd7631d7d4eb434ad4f3a55334c4827ad81131b80b0ce387edf43ad38ccc14d9
4
+ data.tar.gz: b097879f6f4118ab9cb4f4d651c6f0ab9915b4f035276fc86e008101884bbc85
5
5
  SHA512:
6
- metadata.gz: 88131b0546c98187b4965ab9ed7ee4eeb471650280c973a67e16fae0e4b3a3dcbbc5bacaa4ee00aa365834920c7a13781e4650dbf3f96a582c5833d9611b8f06
7
- data.tar.gz: cfb88412c478e79d02a81b7997650f9d74bf05a8b4d9d527933f116a858df66acfa72e0c7ada31d2e94822acf131601137800782e0cb768580eb793692a88f1f
6
+ metadata.gz: ee0a642763f4bbbb641abe64db37e8e3a263a8fe9b64ccbbd673c2121667145b1c57b3f03b73c9bf583019156f2d0b7577592a7ace59a782d86bb6d419b062ba
7
+ data.tar.gz: 67f87705d9019b8c156fbe38e8fd9e947f8d555df69e6bec0a1c520f426cfa92e95878e234c91e344fe956765b5f80d63661f298db01985234f4220291596aba
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tiktoken_ruby (0.0.1)
4
+ tiktoken_ruby (0.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
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 UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
15
+ $ gem install tiktoken_ruby
17
16
 
18
17
  ## Usage
19
18
 
20
- TODO: Write usage instructions here
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/[USERNAME]/tiktoken_ruby.
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/iapark/tiktoken_ruby.
31
34
 
32
35
  ## License
33
36
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tiktoken
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
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
- require_relative "tiktoken_ruby/tiktoken_ruby"
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.1
4
+ version: 0.0.2
5
5
  platform: x86_64-darwin
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.3.11
57
+ version: 3.1.0
58
58
  requirements: []
59
59
  rubygems_version: 3.4.4
60
60
  signing_key: