tiktoken 0.1.0-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Cargo.toml +5 -0
- data/lib/tiktoken/encoder.rb +16 -0
- data/lib/tiktoken/tiktoken.bundle +0 -0
- data/lib/tiktoken/version.rb +3 -0
- data/lib/tiktoken.rb +18 -0
- metadata +50 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f233e52639df448d294faf9376334e70230a897e8e6fb8cc3c160a3a644a0eda
|
4
|
+
data.tar.gz: 1ab52551e05386079680e0a15324a90ba0a304ff1acf5ee5f8f1a0cd6db7ff19
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8433b108d97c3733105b54262a31744ef403d64f0b676136b425d353d8c61fc10e20e3cd4d690153764d9f226df88e272d2a4849c13b123a5297c16936194069
|
7
|
+
data.tar.gz: ec14e446e1a3f356f9d180d94d72ca4d4a27b66e04107c1a02db728f2196c58ffbe9fc0bdc7f23c33c97c3ee6e8c2157b400aee54580b4010408d8d65240b45a
|
data/Cargo.toml
ADDED
@@ -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
|
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-darwin
|
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.bundle
|
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: []
|