tiktoken 0.1.0-x86_64-linux-musl
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.so +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: e030266426a077f984b90c71a19f1a1ee8f30a442e96c43b69c11a0aec141a03
|
4
|
+
data.tar.gz: a653d53784a0c7412c4a9bfde4c39d9bad796b7dce231ab45137b7cac1e3b099
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a718b9dd3c7cda67504af8fc29fbaa6e691cbd244310a1d50124441963650d2cf716506bb00f1f0d1e6834ca5d996d280b6bd098fd441763fbb21279267436b9
|
7
|
+
data.tar.gz: 84b6ce34d9b6d493acef322a0e0ab97b5f83715d4bce9ed9c38f4e3629ea54b8bd50ca1fd1998cdff1175056aaf1c9839f92d7155356e4d2d6ca986da1addae1
|
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-linux-musl
|
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: []
|