@@ -25,12 +25,20 @@ fn o200k_base() -> CoreBPEWrapper {
2525 CoreBPEWrapper :: new ( core_bpe)
2626}
2727
28+ fn o200k_harmony ( ) -> CoreBPEWrapper {
29+ let core_bpe = tiktoken_rs:: o200k_harmony ( ) . unwrap ( ) ;
30+ CoreBPEWrapper :: new ( core_bpe)
31+ }
32+
2833fn module ( ) -> Result < RModule , magnus:: Error > {
2934 Ruby :: get ( ) . unwrap ( ) . define_module ( "Tiktoken" )
3035}
3136
3237fn uncicode_error ( ) -> Result < ExceptionClass , magnus:: Error > {
33- module ( ) ?. define_error ( "UnicodeError" , Ruby :: get ( ) . unwrap ( ) . exception_standard_error ( ) )
38+ module ( ) ?. define_error (
39+ "UnicodeError" ,
40+ Ruby :: get ( ) . unwrap ( ) . exception_standard_error ( ) ,
41+ )
3442}
3543
3644#[ magnus:: init]
@@ -43,6 +51,7 @@ fn init() -> Result<(), Error> {
4351 factory_module. define_singleton_method ( "p50k_edit" , function ! ( p50k_edit, 0 ) ) ?;
4452 factory_module. define_singleton_method ( "cl100k_base" , function ! ( cl100k_base, 0 ) ) ?;
4553 factory_module. define_singleton_method ( "o200k_base" , function ! ( o200k_base, 0 ) ) ?;
54+ factory_module. define_singleton_method ( "o200k_harmony" , function ! ( o200k_harmony, 0 ) ) ?;
4655
4756 let ext_module = module. define_module ( "Ext" ) ?;
4857 let bpe_class = ext_module. define_class ( "CoreBPE" , Ruby :: get ( ) . unwrap ( ) . class_object ( ) ) ?;
0 commit comments