Skip to content

Latest commit

 

History

History
342 lines (194 loc) · 6.48 KB

LlamaContext.md

File metadata and controls

342 lines (194 loc) · 6.48 KB

llama.rn / LlamaContext

Class: LlamaContext

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new LlamaContext(«destructured»)

Parameters

Name Type
«destructured» NativeLlamaContext

Defined in

index.ts:124

Properties

gpu

gpu: boolean = false

Defined in

index.ts:116


id

id: number

Defined in

index.ts:114


model

model: Object = {}

Type declaration

Name Type
isChatTemplateSupported? boolean

Defined in

index.ts:120


reasonNoGPU

reasonNoGPU: string = ''

Defined in

index.ts:118

Methods

applyLoraAdapters

applyLoraAdapters(loraList): Promise<void>

Parameters

Name Type
loraList { path: string ; scaled?: number }[]

Returns

Promise<void>

Defined in

index.ts:239


bench

bench(pp, tg, pl, nr): Promise<BenchResult>

Parameters

Name Type
pp number
tg number
pl number
nr number

Returns

Promise<BenchResult>

Defined in

index.ts:219


completion

completion(params, callback?): Promise<NativeCompletionResult>

Parameters

Name Type
params CompletionParams
callback? (data: TokenData) => void

Returns

Promise<NativeCompletionResult>

Defined in

index.ts:160


detokenize

detokenize(tokens): Promise<string>

Parameters

Name Type
tokens number[]

Returns

Promise<string>

Defined in

index.ts:208


embedding

embedding(text, params?): Promise<NativeEmbeddingResult>

Parameters

Name Type
text string
params? NativeEmbeddingParams

Returns

Promise<NativeEmbeddingResult>

Defined in

index.ts:212


getFormattedChat

getFormattedChat(messages, template?): Promise<string>

Parameters

Name Type
messages RNLlamaOAICompatibleMessage[]
template? string

Returns

Promise<string>

Defined in

index.ts:150


getLoadedLoraAdapters

getLoadedLoraAdapters(): Promise<{ path: string ; scaled?: number }[]>

Returns

Promise<{ path: string ; scaled?: number }[]>

Defined in

index.ts:255


loadSession

loadSession(filepath): Promise<NativeSessionLoadResult>

Load cached prompt & completion state from a file.

Parameters

Name Type
filepath string

Returns

Promise<NativeSessionLoadResult>

Defined in

index.ts:134


release

release(): Promise<void>

Returns

Promise<void>

Defined in

index.ts:261


removeLoraAdapters

removeLoraAdapters(): Promise<void>

Returns

Promise<void>

Defined in

index.ts:251


saveSession

saveSession(filepath, options?): Promise<number>

Save current cached prompt & completion state to a file.

Parameters

Name Type
filepath string
options? Object
options.tokenSize number

Returns

Promise<number>

Defined in

index.ts:143


stopCompletion

stopCompletion(): Promise<void>

Returns

Promise<void>

Defined in

index.ts:200


tokenize

tokenize(text): Promise<NativeTokenizeResult>

Parameters

Name Type
text string

Returns

Promise<NativeTokenizeResult>

Defined in

index.ts:204