Skip to content

Class: LlamaGrammar

Extended by

Constructors

new LlamaGrammar()

ts
new LlamaGrammar(llama: Llama, options: LlamaGrammarOptions): LlamaGrammar

GBNF files are supported. More info here: github:ggerganov/llama.cpp:grammars/README.md

Parameters

ParameterTypeDescription
llamaLlama
optionsLlamaGrammarOptions

Returns

LlamaGrammar

Defined in

evaluator/LlamaGrammar.ts:44

Accessors

grammar

ts
get grammar(): string

Returns

string

Defined in

evaluator/LlamaGrammar.ts:58


rootRuleName

ts
get rootRuleName(): string

Returns

string

Defined in

evaluator/LlamaGrammar.ts:62


stopGenerationTriggers

ts
get stopGenerationTriggers(): readonly (string | LlamaText | readonly (string | Token)[])[]

Returns

readonly (string | LlamaText | readonly (string | Token)[])[]

Defined in

evaluator/LlamaGrammar.ts:66


trimWhitespaceSuffix

ts
get trimWhitespaceSuffix(): boolean

Returns

boolean

Defined in

evaluator/LlamaGrammar.ts:70

Methods

getFor()

ts
static getFor(llama: Llama, type: 
  | "json"
  | "json_arr"
  | "list"
  | "c"
  | "arithmetic"
  | "japanese"
  | "chess"): Promise<LlamaGrammar>

Parameters

ParameterType
llamaLlama
type| "json" | "json_arr" | "list" | "c" | "arithmetic" | "japanese" | "chess"

Returns

Promise<LlamaGrammar>

Defined in

evaluator/LlamaGrammar.ts:74