Class: Llama
Properties
onDispose
ts
readonly onDispose: EventRelay<void>;
Defined in
Accessors
disposed
ts
get disposed(): boolean
Returns
boolean
Defined in
classes
ts
get classes(): LlamaClasses
Returns
Defined in
gpu
ts
get gpu(): LlamaGpuType
Returns
Defined in
supportsGpuOffloading
ts
get supportsGpuOffloading(): boolean
Returns
boolean
Defined in
supportsMmap
ts
get supportsMmap(): boolean
Returns
boolean
Defined in
supportsMlock
ts
get supportsMlock(): boolean
Returns
boolean
Defined in
cpuMathCores
ts
get cpuMathCores(): number
The number of CPU cores that are useful for math
Returns
number
Defined in
maxThreads
ts
get maxThreads(): number
The maximum number of threads that can be used by the Llama instance.
If set to 0
, the Llama instance will have no limit on the number of threads.
See the maxThreads
option of getLlama
for more information.
ts
set maxThreads(value: number): void
Parameters
Parameter | Type |
---|---|
value | number |
Returns
number
Defined in
logLevel
ts
get logLevel(): LlamaLogLevel
ts
set logLevel(value: LlamaLogLevel): void
Parameters
Parameter | Type |
---|---|
value | LlamaLogLevel |
Returns
Defined in
logger
ts
get logger(): (level: LlamaLogLevel, message: string) => void
ts
set logger(value: (level: LlamaLogLevel, message: string) => void): void
Parameters
Parameter | Type |
---|---|
value | (level : LlamaLogLevel , message : string ) => void |
Returns
Function
Parameters
Parameter | Type |
---|---|
level | LlamaLogLevel |
message | string |
Returns
void
Defined in
buildType
ts
get buildType(): "localBuild" | "prebuilt"
Returns
"localBuild"
| "prebuilt"
Defined in
cmakeOptions
ts
get cmakeOptions(): Readonly<Record<string, string>>
Returns
Readonly
<Record
<string
, string
>>
Defined in
llamaCppRelease
ts
get llamaCppRelease(): {
repo: string;
release: string;
}
Returns
ts
{
repo: string;
release: string;
}
repo
ts
readonly repo: string;
release
ts
readonly release: string;
Defined in
systemInfo
ts
get systemInfo(): string
Returns
string
Defined in
vramPaddingSize
ts
get vramPaddingSize(): number
VRAM padding used for memory size calculations, as these calculations are not always accurate. This is set by default to ensure stability, but can be configured when you call getLlama
.
See vramPadding
on getLlama
for more information.
Returns
number
Defined in
Methods
dispose()
ts
dispose(): Promise<void>
Returns
Promise
<void
>
Defined in
getVramState()
ts
getVramState(): Promise<{
total: number;
used: number;
free: number;
}>
Returns
Promise
<{ total
: number
; used
: number
; free
: number
; }>
total
ts
total: number;
used
ts
used: number;
free
ts
free: number;
Defined in
getGpuDeviceNames()
ts
getGpuDeviceNames(): Promise<string[]>
Returns
Promise
<string
[]>
Defined in
loadModel()
ts
loadModel(options: LlamaModelOptions): Promise<LlamaModel>
Parameters
Parameter | Type |
---|---|
options | LlamaModelOptions |
Returns
Defined in
createGrammarForJsonSchema()
ts
createGrammarForJsonSchema<T>(schema: T): Promise<LlamaJsonSchemaGrammar<T>>
Type Parameters
Type Parameter |
---|
T extends Readonly <GbnfJsonSchema > |
Parameters
Parameter | Type |
---|---|
schema | T |
Returns
Promise
<LlamaJsonSchemaGrammar
<T
>>
Defined in
getGrammarFor()
ts
getGrammarFor(type:
| "json"
| "json_arr"
| "list"
| "c"
| "arithmetic"
| "japanese"
| "chess"): Promise<LlamaGrammar>
Parameters
Parameter | Type |
---|---|
type | | "json" | "json_arr" | "list" | "c" | "arithmetic" | "japanese" | "chess" |
Returns
Defined in
createGrammar()
ts
createGrammar(options: LlamaGrammarOptions): Promise<LlamaGrammar>
Parameters
Parameter | Type |
---|---|
options | LlamaGrammarOptions |
Returns
Defined in
defaultConsoleLogger()
ts
static defaultConsoleLogger(level: LlamaLogLevel, message: string): void
Parameters
Parameter | Type |
---|---|
level | LlamaLogLevel |
message | string |
Returns
void