Class: LlamaContext
Constructors
new LlamaContext(options)
ts
new LlamaContext(options): LlamaContext
new LlamaContext(options): LlamaContext
Parameters
Parameter | Type | Description |
---|---|---|
options | LlamaContextOptions |
Source
llamaEvaluator/LlamaContext.ts:78
Accessors
prependBos
ts
get prependBos(): boolean
get prependBos(): boolean
Source
llamaEvaluator/LlamaContext.ts:124
Methods
decode()
ts
decode(tokens): string
decode(tokens): string
Parameters
Parameter | Type |
---|---|
tokens | number [] | Uint32Array |
Source
llamaEvaluator/LlamaContext.ts:114
encode()
ts
encode(text): Uint32Array
encode(text): Uint32Array
Parameters
Parameter | Type |
---|---|
text | string |
Source
llamaEvaluator/LlamaContext.ts:107
evaluate()
ts
evaluate(tokens, options): AsyncGenerator<number, void, unknown>
evaluate(tokens, options): AsyncGenerator<number, void, unknown>
Parameters
Parameter | Type | Description |
---|---|---|
tokens | Uint32Array | |
options | { grammarEvaluationState : LlamaGrammarEvaluationState ; repeatPenalty : LlamaContextRepeatPenalty ; temperature : number ; topK : number ; topP : number ; } | |
options.grammarEvaluationState ? | LlamaGrammarEvaluationState | - |
options.repeatPenalty ? | LlamaContextRepeatPenalty | - |
options.temperature ? | number | - |
options.topK ? | number | - |
options.topP ? | number | - |
Returns
Source
llamaEvaluator/LlamaContext.ts:213
getBosString()
ts
getBosString(): null | string
getBosString(): null | string
Returns
The BOS (Beginning Of Sequence) token as a string.
Source
llamaEvaluator/LlamaContext.ts:167
getBosToken()
ts
getBosToken(): null | number
getBosToken(): null | number
Returns
The BOS (Beginning Of Sequence) token.
Source
llamaEvaluator/LlamaContext.ts:131
getContextSize()
ts
getContextSize(): number
getContextSize(): number
Source
llamaEvaluator/LlamaContext.ts:200
getEosString()
ts
getEosString(): null | string
getEosString(): null | string
Returns
The EOS (End Of Sequence) token as a string.
Source
llamaEvaluator/LlamaContext.ts:179
getEosToken()
ts
getEosToken(): null | number
getEosToken(): null | number
Returns
The EOS (End Of Sequence) token.
Source
llamaEvaluator/LlamaContext.ts:143
getNlString()
ts
getNlString(): null | string
getNlString(): null | string
Returns
The NL (New Line) token as a string.
Source
llamaEvaluator/LlamaContext.ts:191
getNlToken()
ts
getNlToken(): null | number
getNlToken(): null | number
Returns
The NL (New Line) token.
Source
llamaEvaluator/LlamaContext.ts:155
printTimings()
ts
printTimings(): void
printTimings(): void