tiktoken_ruby 0.0.8-x86_64-linux → 0.0.10-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/.vscode/settings.json +5 -0
- data/Gemfile.lock +4 -4
- data/Rakefile +6 -0
- data/lib/tiktoken_ruby/{3.2/tiktoken_ruby.so → tiktoken_ruby.so} +0 -0
- data/lib/tiktoken_ruby/version.rb +1 -1
- data/lib/tiktoken_ruby.rb +4 -1
- data/script/release +33 -0
- metadata +9 -9
- data/lib/tiktoken_ruby/3.1/tiktoken_ruby.so +0 -0
- data/lib/tiktoken_ruby/3.3/tiktoken_ruby.so +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b007f12cdc9c86656a57aaa2394707e3944ae2a521ecb60bebd10cdd4ad1b5e5
|
4
|
+
data.tar.gz: 649fdcf5b9dfb51b195f356bc6b35c23e8eaf315b1172bc9bd5d71d524741278
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cea6328c0e30f4e4ee80f083b694905c5afc4803eb0df6181221e902717a6918e5b1fb48e07f98426e4b3b7ccb7505c770b92241ef6fd07a2a1d4947593246a3
|
7
|
+
data.tar.gz: 238a38c1f5ad732390bb6edec5e6f1afac2e3c3d72486fa6f4b06de04e2bd6b315267c90cf6ef9dfeeff675db9f67cb1754712bdd02ec2d5372ae57dfcea72db
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tiktoken_ruby (0.0.
|
5
|
-
rb_sys (
|
4
|
+
tiktoken_ruby (0.0.10)
|
5
|
+
rb_sys (>= 0.9.87)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
rake (13.1.0)
|
23
23
|
rake-compiler (1.2.5)
|
24
24
|
rake
|
25
|
-
rb_sys (0.9.
|
25
|
+
rb_sys (0.9.105)
|
26
26
|
regexp_parser (2.9.0)
|
27
27
|
rexml (3.2.6)
|
28
28
|
rspec (3.12.0)
|
@@ -89,4 +89,4 @@ DEPENDENCIES
|
|
89
89
|
yard-doctest
|
90
90
|
|
91
91
|
BUNDLED WITH
|
92
|
-
2.
|
92
|
+
2.5.18
|
data/Rakefile
CHANGED
@@ -21,3 +21,9 @@ end
|
|
21
21
|
task build: :compile
|
22
22
|
|
23
23
|
task default: %i[compile spec standard]
|
24
|
+
|
25
|
+
# Packaging default (non-precompiled) gem
|
26
|
+
require "rubygems/package_task"
|
27
|
+
gem_path = Gem::PackageTask.new(GEMSPEC).define
|
28
|
+
desc "Package the Ruby gem"
|
29
|
+
task "package" => [gem_path]
|
Binary file
|
data/lib/tiktoken_ruby.rb
CHANGED
@@ -64,13 +64,15 @@ module Tiktoken
|
|
64
64
|
:r50k_base,
|
65
65
|
:p50k_base,
|
66
66
|
:p50k_edit,
|
67
|
-
:cl100k_base
|
67
|
+
:cl100k_base,
|
68
|
+
:o200k_base
|
68
69
|
]
|
69
70
|
|
70
71
|
# taken from the python library here https://github.com/openai/tiktoken/blob/main/tiktoken/model.py
|
71
72
|
# that is also MIT licensed but by OpenAI
|
72
73
|
MODEL_TO_ENCODING_NAME = {
|
73
74
|
# chat
|
75
|
+
"gpt-4o": "o200k_base",
|
74
76
|
"gpt-4": "cl100k_base",
|
75
77
|
"gpt-3.5-turbo": "cl100k_base",
|
76
78
|
"gpt-35-turbo": "cl100k_base", # Azure deployment name
|
@@ -120,6 +122,7 @@ module Tiktoken
|
|
120
122
|
|
121
123
|
MODEL_PREFIX_TO_ENCODING = {
|
122
124
|
# chat
|
125
|
+
"gpt-4o-": "o200k_base", # e.g., gpt-4o-2024-05-13, etc.
|
123
126
|
"gpt-4-": "cl100k_base", # e.g., gpt-4-0314, etc., plus gpt-4-32k
|
124
127
|
"gpt-3.5-turbo-": "cl100k_base", # e.g, gpt-3.5-turbo-0301, -0401, etc.
|
125
128
|
"gpt-35-turbo-": "cl100k_base", # Azure deployment name
|
data/script/release
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
if [ -z "${TIKTOKEN_PUBLISH_KEY}" ]; then
|
6
|
+
echo "Error: TIKTOKEN_PUBLISH_KEY is not set. This is the RubyGems API key to push the gem."
|
7
|
+
exit 1
|
8
|
+
fi
|
9
|
+
|
10
|
+
version=$(grep VERSION lib/tiktoken_ruby/version.rb | head -n 1 | cut -d'"' -f2)
|
11
|
+
echo "Building tiktoken_ruby v$version"
|
12
|
+
|
13
|
+
targets=(
|
14
|
+
"arm64-darwin"
|
15
|
+
"x86_64-darwin"
|
16
|
+
"aarch64-linux"
|
17
|
+
"x86_64-linux"
|
18
|
+
"x86_64-linux-musl"
|
19
|
+
"arm-linux"
|
20
|
+
"x64-mingw-ucrt"
|
21
|
+
)
|
22
|
+
|
23
|
+
for target in "${targets[@]}"; do
|
24
|
+
bundle exec rb-sys-dock -p "$target" --ruby-versions 3.2 --build
|
25
|
+
done
|
26
|
+
|
27
|
+
for gem in pkg/tiktoken_ruby-"$version"-*.gem ; do
|
28
|
+
GEM_HOST_API_KEY="${TIKTOKEN_PUBLISH_KEY}" gem push "$gem" --host https://rubygems.org
|
29
|
+
done
|
30
|
+
|
31
|
+
# last but not least
|
32
|
+
bundle exec rake package
|
33
|
+
GEM_HOST_API_KEY="${TIKTOKEN_PUBLISH_KEY}" gem push "pkg/tiktoken_ruby-$version.gem" --host https://rubygems.org
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.10
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- IAPark
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An unofficial Ruby wrapper for Tiktoken, a BPE tokenizer written by and
|
14
14
|
used by OpenAI. It can be used to count the number of tokens in text before sending
|
@@ -21,6 +21,7 @@ extra_rdoc_files: []
|
|
21
21
|
files:
|
22
22
|
- ".rspec"
|
23
23
|
- ".standard.yml"
|
24
|
+
- ".vscode/settings.json"
|
24
25
|
- Gemfile
|
25
26
|
- Gemfile.lock
|
26
27
|
- LICENSE.txt
|
@@ -28,11 +29,10 @@ files:
|
|
28
29
|
- Rakefile
|
29
30
|
- doctest_helper.rb
|
30
31
|
- lib/tiktoken_ruby.rb
|
31
|
-
- lib/tiktoken_ruby/3.1/tiktoken_ruby.so
|
32
|
-
- lib/tiktoken_ruby/3.2/tiktoken_ruby.so
|
33
|
-
- lib/tiktoken_ruby/3.3/tiktoken_ruby.so
|
34
32
|
- lib/tiktoken_ruby/encoding.rb
|
33
|
+
- lib/tiktoken_ruby/tiktoken_ruby.so
|
35
34
|
- lib/tiktoken_ruby/version.rb
|
35
|
+
- script/release
|
36
36
|
- sig/tiktoken_ruby.rbs
|
37
37
|
homepage: https://github.com/IAPark/tiktoken_ruby
|
38
38
|
licenses:
|
@@ -49,17 +49,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
49
|
requirements:
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '3.
|
52
|
+
version: '3.2'
|
53
53
|
- - "<"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 3.
|
55
|
+
version: 3.3.dev
|
56
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 3.
|
60
|
+
version: 3.4.0
|
61
61
|
requirements: []
|
62
|
-
rubygems_version: 3.
|
62
|
+
rubygems_version: 3.5.23
|
63
63
|
signing_key:
|
64
64
|
specification_version: 4
|
65
65
|
summary: Ruby wrapper for Tiktoken
|
Binary file
|
Binary file
|