Skip to content

Latest commit

 

History

History
291 lines (166 loc) · 5.46 KB

LlamaContext.md

File metadata and controls

291 lines (166 loc) · 5.46 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:105

Properties

gpu

gpu: boolean = false

Defined in

index.ts:97


id

id: number

Defined in

index.ts:95


model

model: Object = {}

Type declaration

Name Type
isChatTemplateSupported? boolean

Defined in

index.ts:101


reasonNoGPU

reasonNoGPU: string = ''

Defined in

index.ts:99

Methods

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:197


completion

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

Parameters

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

Returns

Promise<NativeCompletionResult>

Defined in

index.ts:141


detokenize

detokenize(tokens): Promise<string>

Parameters

Name Type
tokens number[]

Returns

Promise<string>

Defined in

index.ts:186


embedding

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

Parameters

Name Type
text string
params? NativeEmbeddingParams

Returns

Promise<NativeEmbeddingResult>

Defined in

index.ts:190


getFormattedChat

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

Parameters

Name Type
messages RNLlamaOAICompatibleMessage[]
template? string

Returns

Promise<string>

Defined in

index.ts:131


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:115


release

release(): Promise<void>

Returns

Promise<void>

Defined in

index.ts:217


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:124


stopCompletion

stopCompletion(): Promise<void>

Returns

Promise<void>

Defined in

index.ts:178


tokenize

tokenize(text): Promise<NativeTokenizeResult>

Parameters

Name Type
text string

Returns

Promise<NativeTokenizeResult>

Defined in

index.ts:182