Skip to content

Class: SpecialTokensText

Constructors

new SpecialTokensText()

ts
new SpecialTokensText(value: string): SpecialTokensText

Parameters

ParameterType
valuestring

Returns

SpecialTokensText

Defined in

utils/LlamaText.ts:433

Properties

value

ts
readonly value: string;

Defined in

utils/LlamaText.ts:431

Methods

toString()

ts
toString(): string

Returns

string

Defined in

utils/LlamaText.ts:437


tokenize()

ts
tokenize(tokenizer: Tokenizer, trimLeadingSpace: boolean): Token[]

Parameters

ParameterTypeDefault value
tokenizerTokenizerundefined
trimLeadingSpacebooleanfalse

Returns

Token[]

Defined in

utils/LlamaText.ts:441


tokenizeSpecialTokensOnly()

ts
tokenizeSpecialTokensOnly(tokenizer: Tokenizer): (string | Token)[]

Parameters

ParameterType
tokenizerTokenizer

Returns

(string | Token)[]

Defined in

utils/LlamaText.ts:445


toJSON()

ts
toJSON(): LlamaTextSpecialTokensTextJSON

Returns

LlamaTextSpecialTokensTextJSON

Defined in

utils/LlamaText.ts:469


fromJSON()

ts
static fromJSON(json: LlamaTextSpecialTokensTextJSON): SpecialTokensText

Parameters

ParameterType
jsonLlamaTextSpecialTokensTextJSON

Returns

SpecialTokensText

Defined in

utils/LlamaText.ts:493


isSpecialTokensTextJSON()

ts
static isSpecialTokensTextJSON(value: LlamaTextJSONValue): value is LlamaTextSpecialTokensTextJSON

Parameters

ParameterType
valueLlamaTextJSONValue

Returns

value is LlamaTextSpecialTokensTextJSON

Defined in

utils/LlamaText.ts:500


wrapIf()

ts
static wrapIf(shouldWrap: boolean, value: string): string | SpecialTokensText

Wraps the value with a SpecialTokensText only if shouldWrap is true

Parameters

ParameterType
shouldWrapboolean
valuestring

Returns

string | SpecialTokensText

Defined in

utils/LlamaText.ts:507