Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Flutter_rust_bridge for tokenizers crate generates faulty code
Hello,
Recently I have been trying to incorporate on-device AI Text Embeddings into my Flutter app. Since there is no straight-forward library in Flutter I wanted to use flutter_rust_bridge
. The respective crate can be found under: crates.io: Rust Package Registry.
My idea was to use the tokenizers
crate for the tokenization process, implement it in rust, generate the respective dart bindings using flutter_rust_bridge_codegen generate
and later run an embedding model directly in dart.
The problem is that the flutter_rust_bridge
crate has limited support for automatic third-party translation when generating the bindings. I tiredly tried the manual approach but I don't manage to make it work - I am quite overwhelmed since it is new for me. The bindings are always faulty, though I know that it should be possible:
If it errors, then yes the experimental automatic translation cannot understand some part of it yet. But given that the API amount may not be large, the manual approach may not take a large amount of time (via the library OP)
My API is fairly simple: Load a tokenizer from a given JSON file and expose one function tokenize
that calls: tokenizer.encode("Hey there!", false)?;
Greetings and many thanks!
1 post - 1 participant
🏷️ rust_feed