Added FFI bindings for rust lib
Added an alternative implementation of the encoder using tiktoken-rs library (#27).
Added
- Added
Yethee\Tiktoken\Exception\IOErrorclass - Added
Yethee\Tiktoken\Exception\LibErrorclass - Added
Yethee\Tiktoken\Encoder\LibEncoderclass - Added
Yethee\Tiktoken\Encoder\NativeEncoderclass - Added
Yethee\Tiktoken\Vocab\VocabLoader::loadFile()method
Changed
Yethee\Tiktoken\Encoderis now an interface- Added argument
$useLibtoYethee\Tiktoken\EncoderProviderconstructor- public function __construct() + public function __construct(private bool $useLib = false)
- [BC break] You can no longer disable cache for vocabs.
Changes signature ofEncoderProvider::setVocabCache()method:- public function setVocabCache(string|null $cacheDir): void + public function setVocabCache(string $cacheDir): void