Class: LlamaText
Constructors
new LlamaText()
ts
new LlamaText(...values: readonly LlamaTextInputValue[]): LlamaText
Can also be called without new
Parameters
Parameter | Type |
---|---|
...values | readonly LlamaTextInputValue [] |
Returns
Defined in
Properties
values
ts
readonly values: readonly LlamaTextValue[];
Defined in
Methods
concat()
ts
concat(value: LlamaTextInputValue): LlamaText
Parameters
Parameter | Type |
---|---|
value | LlamaTextInputValue |
Returns
Defined in
mapValues()
ts
mapValues(mapper: (this: readonly LlamaTextValue[], value: LlamaTextValue, index: number, values: readonly LlamaTextValue[]) => LlamaTextInputValue): LlamaText
Parameters
Parameter | Type |
---|---|
mapper | (this : readonly LlamaTextValue [], value : LlamaTextValue , index : number , values : readonly LlamaTextValue []) => LlamaTextInputValue |
Returns
Defined in
joinValues()
ts
joinValues(separator: LlamaTextValue | LlamaText): LlamaText
Joins the values with the given separator.
Note that the values are squashed when they are loaded into the LlamaText
, so the separator is not added between adjacent strings.
To add the separator on values before squashing them, use LlamaText.joinValues
instead.
Parameters
Parameter | Type |
---|---|
separator | LlamaTextValue | LlamaText |
Returns
Defined in
toString()
ts
toString(): string
Returns
string
Defined in
toJSON()
ts
toJSON(): LlamaTextJSON
Returns
Defined in
tokenize()
ts
tokenize(tokenizer: Tokenizer, options?: "trimLeadingSpace"): Token[]
Parameters
Parameter | Type |
---|---|
tokenizer | Tokenizer |
options ? | "trimLeadingSpace" |
Returns
Token
[]
Defined in
compare()
ts
compare(other: LlamaText): boolean
Parameters
Parameter | Type |
---|---|
other | LlamaText |
Returns
boolean
Defined in
trimStart()
ts
trimStart(): LlamaText
Returns
Defined in
trimEnd()
ts
trimEnd(): LlamaText
Returns
Defined in
includes()
ts
includes(value: LlamaText): boolean
Parameters
Parameter | Type |
---|---|
value | LlamaText |
Returns
boolean
Defined in
fromJSON()
ts
static fromJSON(json: LlamaTextJSON): LlamaText
Parameters
Parameter | Type |
---|---|
json | LlamaTextJSON |
Returns
Defined in
compare()
ts
static compare(a: LlamaText, b: LlamaText): boolean
Parameters
Parameter | Type |
---|---|
a | LlamaText |
b | LlamaText |
Returns
boolean
Defined in
fromTokens()
ts
static fromTokens(tokenizer: Tokenizer, tokens: Token[]): LlamaText
Attempt to convert tokens to a LlamaText
while preserving special tokens.
Non-standard special tokens that don't have a text representation are ignored.
Parameters
Parameter | Type |
---|---|
tokenizer | Tokenizer |
tokens | Token [] |
Returns
Defined in
joinValues()
ts
static joinValues(separator: string | LlamaText, values: readonly LlamaTextInputValue[]): LlamaText
Join values with the given separator before squashing adjacent strings inside the values
Parameters
Parameter | Type |
---|---|
separator | string | LlamaText |
values | readonly LlamaTextInputValue [] |
Returns
Defined in
isLlamaText()
ts
static isLlamaText(value: unknown): value is LlamaText
Parameters
Parameter | Type |
---|---|
value | unknown |
Returns
value is LlamaText