ai.decode

Returns the text from its tokenized representation.

Syntax

decode(tokens, options?)

Parameters

Return value

The decoded string.

Examples

ai.decode([1, 29871, 22172], { model: 'llama2-7b-chat' })
"hello"

ai.decode([100264, 15339, 1917, 0], { model: "gpt-4", specials: {"<|im_start|>": 100264 }})
"<|im_start|>hello world!"

See also