Class: LlamaJsonSchemaGrammar<T>
Extends
Type Parameters
Type Parameter |
---|
T extends Readonly <GbnfJsonSchema > |
Constructors
new LlamaJsonSchemaGrammar()
ts
new LlamaJsonSchemaGrammar<T>(llama: Llama, schema: T): LlamaJsonSchemaGrammar<T>
Prefer to create a new instance of this class by using llama.createGrammarForJsonSchema(...)
.
Parameters
Parameter | Type |
---|---|
llama | Llama |
schema | T |
Returns
Overrides
Defined in
evaluator/LlamaJsonSchemaGrammar.ts:14
Accessors
grammar
ts
get grammar(): string
Returns
string
Inherited from
Defined in
rootRuleName
ts
get rootRuleName(): string
Returns
string
Inherited from
Defined in
stopGenerationTriggers
ts
get stopGenerationTriggers(): readonly (string | LlamaText | readonly (string | Token)[])[]
Returns
readonly (string
| LlamaText
| readonly (string
| Token
)[])[]
Inherited from
LlamaGrammar
.stopGenerationTriggers
Defined in
trimWhitespaceSuffix
ts
get trimWhitespaceSuffix(): boolean
Returns
boolean
Inherited from
LlamaGrammar
.trimWhitespaceSuffix
Defined in
Methods
getFor()
ts
static getFor(llama: Llama, type:
| "json"
| "json_arr"
| "list"
| "c"
| "arithmetic"
| "japanese"
| "chess"): Promise<LlamaGrammar>
Parameters
Parameter | Type |
---|---|
llama | Llama |
type | | "json" | "json_arr" | "list" | "c" | "arithmetic" | "japanese" | "chess" |
Returns
Inherited from
Defined in
parse()
ts
parse(json: string): GbnfJsonSchemaToType<T>
Parameters
Parameter | Type |
---|---|
json | string |