tiktoken 0.1.0-x86_64-linux

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b7f9da1fa201b52dd5233c02575c113070bd298f386f3880965f4d70b627309c
4
+ data.tar.gz: 38c6f10bf03a80eae89151319a9ac9a9ea23489478f8d1701d1d91c4015c83c4
5
+ SHA512:
6
+ metadata.gz: 6de91cb53e377e29c1f2e61774eb299385ad7f80f1b5dc94eb26ca312c5845b515ecad2c6cbe2ac337995c6d9afe6b3b022e06e5591876b8b202559e558d2aa6
7
+ data.tar.gz: b15a47ba5bb27e4baee2f83e74bae233ee205e95eaccdf9c8e64257296d32d674dc45d6549504f0779726e0e4e77bf6c26b2757b14e3bc79e579ea8272c5a41a
data/Cargo.toml ADDED
@@ -0,0 +1,5 @@
1
+ [workspace]
2
+ members = ["ext/tiktoken"]
3
+
4
+ [profile.release]
5
+ strip = true
@@ -0,0 +1,16 @@
1
+ module Tiktoken
2
+ class Encoder
3
+ def encode(text, allowed_special=[], disallowed_special="all")
4
+ _encode(text, allowed_special, disallowed_special)
5
+ end
6
+
7
+ def encode_ordinary(text)
8
+ _encode_ordinary(text)
9
+ end
10
+
11
+ def decode(tokens, utf_opts={invalid: :replace, undef: :replace})
12
+ _bytes = _decode(tokens)
13
+ _bytes.pack('C*').encode('UTF-8', **utf_opts)
14
+ end
15
+ end
16
+ end
Binary file
@@ -0,0 +1,3 @@
1
+ module Tiktoken
2
+ VERSION = "0.1.0"
3
+ end
data/lib/tiktoken.rb ADDED
@@ -0,0 +1,18 @@
1
+ begin
2
+ require_relative "tiktoken/#{RUBY_VERSION.to_f}/tiktoken"
3
+ rescue LoadError
4
+ require_relative "tiktoken/tiktoken"
5
+ end
6
+
7
+ require_relative "tiktoken/version"
8
+ require_relative "tiktoken/encoder"
9
+
10
+ module Tiktoken
11
+ def self.get_encoding(encoding, extra_special_tokens={})
12
+ Tiktoken._get_encoding(encoding, extra_special_tokens)
13
+ end
14
+
15
+ def self.encoding_for_model(model, extra_special_tokens={})
16
+ Tiktoken._encoding_for_model(model, extra_special_tokens)
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tiktoken
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: x86_64-linux
6
+ authors:
7
+ - Arjun Singh
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-03-21 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: arjun@volition.co
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - Cargo.toml
20
+ - lib/tiktoken.rb
21
+ - lib/tiktoken/encoder.rb
22
+ - lib/tiktoken/tiktoken.so
23
+ - lib/tiktoken/version.rb
24
+ homepage: https://github.com/volition-co/tiktoken
25
+ licenses:
26
+ - MIT
27
+ metadata: {}
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '3.2'
37
+ - - "<"
38
+ - !ruby/object:Gem::Version
39
+ version: 3.3.dev
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubygems_version: 3.4.4
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: Wrapper for OpenAI's tiktoken library
50
+ test_files: []