MCPcopy Index your code
hub / github.com/ceifa/tiktoken-node / decode

Method decode

src/lib.rs:22–30  ·  view source on GitHub ↗
(&self, tokens: Vec<u32>)

Source from the content-addressed store, hash-verified

20
21 #[napi]
22 pub fn decode(&self, tokens: Vec<u32>) -> Result<String, Error> {
23 match self
24 .encoding
25 .decode(tokens.iter().map(|x| *x as usize).collect())
26 {
27 Ok(text) => Ok(text),
28 Err(err) => Err(Error::from_reason(err.to_string())),
29 }
30 }
31
32 #[napi]
33 pub fn encode_batch(&self, texts: Vec<String>) -> Vec<Vec<u32>> {

Callers 1

index.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected